in reply to Double-bytes handling with Perl

Maybe you've already determined the cause of your problems, but there is one potential difference between wc -l and print scalar @array:

In your code, you skip empty lines:

next if ($line =~ /^\s*$/);

... but wc -l will count these. I would keep separate counts for all types of lines encountered and output these as statistics.

Replies are listed 'Best First'.
Re^2: Double-bytes handling with Perl
by fredo2906 (Acolyte) on Oct 10, 2013 at 08:02 UTC

    Yes, i skip empty lines in perl, just in case. But in this example there is no empty lines in the file. Thanks for your concern.