in reply to string as a HASH ref

You could make it work by putting a "no strict 'refs';" in front of it, but you shouldn't. Don't use variables as variable references. Instead, make a hash of hashes.
my %names; $names{fred1} = {1 => "un", 2 => "deux", 3 => "trois"}; $names{mary1} = {1 => "eins", 2 => "zwei", 3 => "drei"}; ... print $names{$n}{$m};