in reply to Variable access using other variable data
Instead of using variables with variable names, you should use a hash with the former variable names as keys.
my %fruits = ( pear_apple_peach => 1, pear_damson_orange => 2, ); my @parts = ('pear', 'apple', 'peach'); my $key = join '_', @parts; print $fruits{$key};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Variable access using other variable data
by merrymonk (Hermit) on Oct 17, 2010 at 09:51 UTC |