in reply to Re: auto increment
in thread auto increment

You don't need to store all the lines to count them. You can just count them when reading them:
my $count = 0; $count++ while <FILE>;

In fact, Perl already does that.

1 while <FILE>; my $count = $.;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^3: auto increment
by edimusrex (Monk) on May 05, 2015 at 15:35 UTC
    Ah, that's a nice tip. Thanks