in reply to Creating a new variable named the contents of another

May be a hash would be better

my %h = ( ipaddress => "foo_0", username => "foo_1", password => "foo_2", sessionid => "foo_3", version => "foo_4", ); sub foo { my $parameter = $_[0]; print "\nParameter: $parameter\n"; die "Bad parameter $paramenter" unless exists $h{$parameter}; return $h{$parameter}; } my $returned = &foo(@ARGV[0]); print "Returned: $returned\n";