in reply to unsure how to use variable
And then, there is always using a hash. Arrays are great, but you have to "shift" the count to fit, since array indices (in any sane language, anyway) always start at 0.
my %h = ( 1 => 'bleen', 2 => 'grue', 3 => 'smellow', ); for my $count (1..3){ print $h{$count}; }
(Amazing what you can learn here if you just ask the right kind of question, isn't it? :)
-- I hate storms, but calms undermine my spirits. -- Bernard Moitessier, "The Long Way"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unsure how to use variable
by tobyink (Canon) on Feb 17, 2012 at 18:14 UTC | |
by oko1 (Deacon) on Feb 18, 2012 at 04:54 UTC |