use strict; use warnings; my $counter=0; my @bin; while( my $line = <> ) { $counter++; $bin[$counter] = $line; }
see perldata#List-value-constructors for details on arrays (numbers as indices) and hashes (strings as keys)
and please always use
use strict; use warnings;
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Re: Use an incrementing counter as a variable (arrays)
by LanX
in thread Use an incrementing counter as a variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |