Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Experts,
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.
Back to
Seekers of Perl Wisdom