in reply to dynamic hash name
You can, but it involves symbolic references that you really shouldn't bother with until you know why.
Instead, you need a symbol table of your own. Either:
ormy %destinations; if ($line =~ /.*Cannot find valid (destination) for type:(.*)=(.*)/) { $destinations{$type}{$key} = ""; }
The first option is better. (Advanced monks may disagree, but for beginners, it simply is better. You can learn the second way when you really understand the first way and its limitations.)my %citystate; my %citycountry; my %country; my %airportCode; my %geonameid; my %symboltable = ( citystate => \%citystate, citycountry => \%citycountry, country => \%country, airportCode => \%airportCode, geonameid => \%geonameid ); if ($line =~ /.*Cannot find valid (destination) for type:(.*)=(.*)/) { $symboltable{$type}{$key} = "" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: dynamic hash name
by priyankgandhi (Novice) on Feb 03, 2009 at 00:38 UTC | |
by ikegami (Patriarch) on Feb 03, 2009 at 01:34 UTC |