in reply to Specifiying a Range for Variables?
I'll refrain from the obligatory "You should use a hash instead..." statement on the assumption that this is simply a learning exercise. :)$cmd1 = 'This'; $cmd2 = 'Is'; $cmd3 = 'a'; $cmd4 = 'test'; my @cmds = map {${"cmd$_"}} (1..4); for (@cmds){ print "$_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Specifiying a Range for Variables?
by Aristotle (Chancellor) on Nov 27, 2002 at 17:36 UTC |