[Bioperl-l] Bioperl objects and subroutines

Jason Stajich jason at cgt.duhs.duke.edu
Wed May 12 09:14:25 EDT 2004


sub method {
  my ($seq) = @_;
  print $seq->length;
}

&method($seqobj);

-jason
On Wed, 12 May 2004, Jonathan Manning wrote:

> Hi all,
>
> Sorry if this seems more like a general perl question, but I can't find
> the answer I need in my books.
>
> How do I pass an object (specifically a Bio::Seq object) to a perl
> subroutine? I thought object variables were references anyway, but
> passing those variables didn't work. At the moment I pass a reference
> like:
>
> $reference = \$seqobject;
> &subroutine($reference);
>
> And within the subroutine attempt to access like:
>
> $sequence = bless @_[0];
>
> But this doesn't work either, and I can't access the object methods.
>
> Obviously I'm no perl veteran, and don't really know how to do it.
> Thanks in advance for any help.
>
> Jon
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list