in reply to Perl Variables

Firstly, your subroutine is not going to do what you think. This line

my $tgs = @_;

is going to assign the number of elements in @_ to $tgs because the LHS is in scalar context. Do this

my ($tgs) = @_;

or this

my $tgs = shift;

instead.

Rather than trying to make the contents of $tgs part of the hash name, you might be able to accomplish what you need using a HoH structure. Something like

my %Test_hash; ... sub xyz { my ($tgs) = @_; $Test_hash{$tgs} = {a => 1, b => 2}; ... } ...

I hope this is of interest.

Cheers,

JohnGG