$ perl -le ' > $text = q{this text}; > print do{ $text =~ s{this}{that}; $text };' that text $ #### $ perl -le ' > $text = q{this text}; > print map { s{this}{that}; $_ } $text;' that text $