windows.li
求解《Intermediate Perl》上一道习题!
[quote]Write a program that takes a list of filenames on the command line and uses grep to select the ones whose size in bytes is less than 1000. Use map to transform the strings in this list, putting four space characters in front of each and a newline character after. Print the resulting list.
[/quote]
[quote][b][i]书上提供的答案:[/i][/b]
print map { " $_/n" } grep { -s < 1000 } @ARGV;
[/quote]
[b]我在WIN平台运行总出现错误:[/b]
[color=DarkRed]Warning: Use of "-s" without parentheses is ambiguous at oo.pl.txt line 1.
Unterminated <> operator at oo.pl.txt line 1.[/color]
-s需要圆括号么?貌似不用的。请大家指教,谢谢!