in reply to creating 100 arrays
Here is how you do it:
use strict; use warnings; for( 1 .. 100 ) { no strict 'refs'; @{'H' . $_} = (); }
And here's "Why it's stupid to `use a variable name as a variable name'" (in other words, why you shouldn't), in three parts:
And here's what you probably should be doing instead:
use strict; use warnings; my @H; for( 1 .. 100 ) { push @H, []; }
The latter gives you an array, "@H" containing elements 0 through 99, each of which contains a reference to an array. In both cases, presumably you would actually have something to put into the arrays more meaningful than an empty list, so obviously these are just examples. Now it's time to read perllol.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: creating 100 arrays
by AnomalousMonk (Archbishop) on Jul 04, 2012 at 17:45 UTC |