http://www.perlmonks.org?node_id=688598


in reply to Ranking files, largest to smallest

Hi ewexperts,

Change

my @lines = <FILE>; chop(@lines); foreach my $str (@lines) { chomp(@lines); }
into chomp (@lines = <FILE>);

Here chop is not necessary to remove the newline character, it ll remove the last character, not only newline character. Instead you can use chomp which removes only the newline character at the end.

Prasad