in reply to How to use -0 (zero) option in perl

-0 only says how to read. You also need to tell perl to read the file :-). Like this: perl -0777 -ne 'print' foo.out. (The "n" option tells perl to read.)

Best, beth

Replies are listed 'Best First'.
Re^2: How to use -0 (zero) option in perl
by ikegami (Patriarch) on Jul 07, 2009 at 15:39 UTC

    There's no reason to use -0777 in that example.

    perl -0777 -ne'print' in.txt

    and

    perl -ne'print' in.txt

    produce the same output. The difference is the former only loops once since it loaded the entire file into memory at once. The latter reads and prints a line at a time.

    You can see the difference in the following:

    perl -0777 -nle'print "[[[$_]]]"' in.txt

    and

    perl -nle'print "[[[$_]]]"' in.txt
      Thank you so much for your reply.