E
evillen
Hi
Is there a more elegant to assign one hash to another - the solution
below works:
my $table = 'c';
my %dbitems;
if($table eq 'a'){%dbitems = %a}
elsif($table eq 'b'){%dbitems = %b}
elsif($table eq 'c'){%dbitems = %c}
elsif($table eq 'd'){%dbitems = %d}
elsif($table eq 'e'){%dbitems = %e}
elsif($table eq 'f'){%dbitems = %f}
elsif($table eq 'g'){%dbitems = %g}
but I hoped something like this would achieve the same:
my $table = 'c';
my %dbitems = %.$table;
I've tried variations but I get syntax errors such as:
"Can't use string ("c") as a HASH ref while "strict refs"" or "Only
hard references are allowed by "strict refs""
Thanks for any help
NJH
Is there a more elegant to assign one hash to another - the solution
below works:
my $table = 'c';
my %dbitems;
if($table eq 'a'){%dbitems = %a}
elsif($table eq 'b'){%dbitems = %b}
elsif($table eq 'c'){%dbitems = %c}
elsif($table eq 'd'){%dbitems = %d}
elsif($table eq 'e'){%dbitems = %e}
elsif($table eq 'f'){%dbitems = %f}
elsif($table eq 'g'){%dbitems = %g}
but I hoped something like this would achieve the same:
my $table = 'c';
my %dbitems = %.$table;
I've tried variations but I get syntax errors such as:
"Can't use string ("c") as a HASH ref while "strict refs"" or "Only
hard references are allowed by "strict refs""
Thanks for any help
NJH