my $d; foreach ($d = 'Shakespear is the food') { s/foo/bar/; } #### (sub { $_[0] =~ s/foo/bar/ })->(my $d = 'Shakespear is the food');