$a=$magichash{'/path/to/file/fn'}; # now $a contains file contents $magichash{'/path/to/file/fn'} =~ s/foo/bar/g; # please guess...