It's not working because s/// returns the number of replacements that it did, not the string after replacement. If you want that, you can say map { s/.../.../; $_ } @stuff. Note, however, that this modifies the original list. Since you're modifying the values in place anyway, you might as well use a for loop instead.
s/(.*)/ $1\n/ for @small_files;
The error you get without the parentheses on grep is (at least when I tried it):
Warning: Use of "-s" without parentheses is ambiguous Unterminated <> operator
You can disambiguate -s by putting $_ in the expression explicitly.
my @small_files = grep -s $_ < 10_000, @ARGV;
Otherwise, it thinks that you were going to say something like -s <STDIN> but forgot the closing >.
In reply to Re: Newbie: parentheses, map, etc.
by kyle
in thread Newbie: parentheses, map, etc.
by nefigah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |