in reply to Use an incrementing counter as a variable
It's theoretically possible, but "it's stupid to use a variable as a variable name".
Usually, a hash serves well in these situations:
use warnings; use strict; my $counter = 0; my %hash; while (<>) { $counter++; $hash{"bin_$counter"} = $_; # or whatever } use Data::Dumper; print Dumper(\%hash);
|
|---|