sub xyz { my ($tgs) = @_; return eval <<"END_OF_SUB_XYZ"; my %Test_hash_$tgs; my \$other = "Why did I do this?"; print "\$other Now I have to escape so many things.\n"; END_OF_SUB_XYZ ; }