Jay Savage wrote:

If you want to see grep really shine, though, think about ways you
might use it to avoid calling print for every element in the return
list, e.g.

    print join "\n", grep {$_ % 2 == 0} @list;

I think that's very misleading. Why should I want to avoid calling print
for each element? What you've written is the sort of thing for which
Perl gets a bad name - it's less readable and has no obvious benefits
over

  print "$_\n" foreach grep { $_ % 2 == 0 } @list;

(It also doesn't print a terminating "\n")

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to