Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am storing some database column names in hash and based on the parameter passed with perl script i need to selecr the particular hash
Example:
test.pl A, the hash to be selected is @COL_CHECK_A and if its B, we need to select @COL_CHECK_B
my @hash; my @field; my @COL_CHECK_A = qw( NAME CITY STATE ); my @COL_CHECK_B = qw( NAME CITY STATE COUNTY ); my @COL_CHECK_C = qw( NAME AGE STATE COUNTY ); my @COL_CHECK_D = qw( NAME AGE CITY STATE COUNTY ); my @COL_CHECK_E = qw( NAME AGE DESIGNATION CITY STATE COUNTY );
foreach my $key (@COL_CHECK_$ARGV[0]) { push( @field, $hash{$key} ); }
Any suggestions please.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help on Hashes
by hdb (Monsignor) on May 14, 2014 at 07:35 UTC | |
|
Re: Help on Hashes
by muba (Priest) on May 15, 2014 at 15:33 UTC |