my %hash = map {$_ => sub {return "

$_

"} } (1..5); $_ = 'foo'; print &{$hash{2}}; #### my %hash = map {$_ => "

$_

" } (1..5);