in reply to perl -pl with next?

From perldoc perlrun:

-p causes Perl to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed: LINE: while (<>) { ... # your program goes here } continue { print or die "-p destination: $!\n"; }

So the next statement makes continue block executed. I think -n with explicit print is the better solution. Or maybe you can try a $_="" (untested, just a thought).

Replies are listed 'Best First'.
Re^2: perl -pl with next?
by hv (Prior) on Jan 27, 2005 at 09:26 UTC

    Or maybe you can try a $_="" (untested, just a thought).

    Due to the presence of the -l flag, that will still print a newline. The -n solution works fine though.

    Hugo

      Good catch++

      Too early here in Spain to notice a little -l :( .

      I think I need more coffee.