in reply to Use an incrementing counter as a variable
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use an incrementing counter as a variable (arrays)
by AnomalousMonk (Archbishop) on Sep 11, 2017 at 17:15 UTC |