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
    The suggestion:
    my @small_files = grep { -s < 10000 } @ARGV;

    looked good to me, and turned out to be basically what the book gave as the answer as well... except I tried it myself and it doesn't compile. oO
    Gives the same error as my original version. (Unterminated <>)

    kyle's suggestion seems to work great though (reversing -s and 10000).