in reply to Re^2: getting line count in cmd.exe
in thread getting line count in cmd.exe

There's no reason why that should be. Why would <> returns something different based on the input's extension.

>perl -MO=Deparse -pe"}{$\=$." LINE: while (defined($_ = <ARGV>)) { (); } { $\ = $.; } continue { die "-p destination: $!\n" unless print $_; } -e syntax OK

And I don't see it happening

>perl -pe"}{$\=$." script.pl 56 >copy script.pl test.txt 1 file(s) copied. >perl -pe"}{$\=$." test.txt 56

Provide a hexdump of your text file if you want to look into this further.

Replies are listed 'Best First'.
Re^4: getting line count in cmd.exe
by ww (Archbishop) on Sep 16, 2008 at 02:18 UTC

    My error was in failing to unwrap lines.

    Meh; duh!

    Thanks for putting me on the right track.