in reply to regular expression in a hash

Your 'pattern' is not being strored as a pattern but as a literal string.
So

my $newname=$Ren2Dol{$base};
is not doing a pattern match, but just a lookup

Then you would need to iterate through your patterns and reassign the name on success.

use strict; use warnings; my $string = '^a{4}b{2}'; my $patt = qr/$string/; my %hsh = ($string => $string, $patt => $patt,); my $test = 'aaaabb'; foreach (keys %hsh){ print "YES for regex : $_\n" if $test =~ /$_/; } print "YES for existance : $_\n" if (exists$hsh{$test});

see qr// and perlre for how to compile a string into a pattern.

Hope this helps!

Just a something something...