#!/usr/bin/perl -w use strict; # this messes up the intended empty pattern later: $_ = 'match'; /m/; my $prefix = 'dog'; my %hash = map {++$;,$_} (qw(ged house ma matic),''); print "Before:\n"; print "$_ => '$hash{$_}'\n" for keys %hash; s//$prefix/for values%hash; # Add the Prefix... print "\nAfter:\n"; print "$_ => '$hash{$_}'\n" for keys %hash; __END__ output: Before: 1 => 'ged' 2 => 'house' 3 => 'ma' 4 => 'matic' 5 => '' After: 1 => 'ged' 2 => 'house' 3 => 'doga' 4 => 'dogatic' 5 => ''