[Bioperl-l] The usage of $field->$_

Kevin Brown Kevin.M.Brown at asu.edu
Fri Jun 4 20:46:36 UTC 2010


That's because you are mixing up two things.

-> is an accessor and not part of a variable.

$_ is a variable and is in perlvar.

And this isn't a list for learning PERL. There are plenty of resources out their for learning general PERL information.

Kevin Brown
Center for Innovations in Medicine
Biodesign Institute
Arizona State University  

> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org 
> [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Peng Yu
> Sent: Friday, June 04, 2010 1:27 PM
> To: Mark A. Jensen
> Cc: bioperl-l at lists.open-bio.org
> Subject: Re: [Bioperl-l] The usage of $field->$_
> 
> I know this is not a hard question. But I'm still learning perl.
> 
> I don't see the usage "->$_" in man perlvar. Would you please show me
> where is the documentation that has detailed discussion on this?
> 
> On Fri, Jun 4, 2010 at 3:06 PM, Mark A. Jensen 
> <maj at fortinbras.us> wrote:
> > This is a fairly basic perl idiom. $_ is changing with the 
> outer loop
> > containing the print statement, which is probably looping 
> through the
> > accessors for the object represented by $field.
> > ----- Original Message ----- From: "Peng Yu" <pengyu.ut at gmail.com>
> > To: <bioperl-l at lists.open-bio.org>
> > Sent: Friday, June 04, 2010 12:15 PM
> > Subject: [Bioperl-l] The usage of $field->$_
> >
> >
> >> In the Eutilities cookbook,
> >> http://www.bioperl.org/wiki/HOWTO:EUtilities_Cookbook
> >>
> >> I see the following code,
> >>
> >>   print join(',', grep {$field->$_} qw(is_date
> >>              is_singletoken is_hierarchy is_hidden 
> is_numerical)),"\n\n";
> >>
> >> I'm not quite familiar with the usage of $field->$_. I 
> don't see where
> >> it is covered in man perlvar (I don't the usage of $_ for pattern
> >> matching, but not in $variable->$). Would you please let 
> me know where
> >> is the document that explain this usage?
> >>
> >> --
> >> Regards,
> >> Peng
> >> _______________________________________________
> >> Bioperl-l mailing list
> >> Bioperl-l at lists.open-bio.org
> >> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >>
> >>
> >
> >
> 
> 
> 
> -- 
> Regards,
> Peng
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 




More information about the Bioperl-l mailing list