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

Chris Fields cjfields at illinois.edu
Sat Jun 5 06:51:30 EDT 2010

$_ is the value being iterated through in a grep of a list of values.  This is just using that list as methods (like $field->is_date, but for each method), testing the return value as defined, and if so adding to the list for the join. 


On Jun 4, 2010, at 11:15 AM, Peng Yu wrote:

> 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

More information about the Bioperl-l mailing list