in reply to Newbie: parentheses, map, etc.
Second question.
Why was that the case?
Why did you have to put the parentheses in? Or why did that make you sad?
If it made you sad because you felt there should be a way of writing it without parentheses, then your instincts are sound.
The trouble, as theDamian explains in Perl Best Practices, "Mapping and Grepping", is that
when the first argument to a map or grep is specified as an expression, it becomes harder to distinguish from the remaining arguments.
His recommendation is to say
map BLOCK LIST
which in your case would be
my @small_files = grep { -s < 10000 } @ARGV;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Newbie: parentheses, map, etc.
by nefigah (Monk) on Mar 04, 2008 at 06:02 UTC |