in reply to initializing multiple arrays
This was my test:
#!/usr/bin/perl use strict; use warnings; use vars; my @array_references; for(0..9) { $array_references[$_] = [1..100]; } for(0..9) { my $aname = sprintf('array%02d', $_); vars->import("\@$aname"); @$aname = @{$array_references[$_]}; } print "@array01";
Which doesn't work. If I remove the strict/warnings section, it in fact does create the arrays and work as expected.
But how do you accomplish this (regardless of whether it's stupid or not) and keep warnings/strictness?
mr.nick ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: initializing multiple arrays
by boftx (Deacon) on May 30, 2014 at 20:47 UTC |