use 5.010000; use strict; use warnings; use diagnostics; my @foo = (qw| Pear Apple AppleTomatoApple |); for ( @foo ) { my $text = 'Apple has determined, ' . 'the iPod nano ' . 'may overheat. ' ; my $assign = 'Blueberry jam vendor!'; $text =~ s/Apple/Mango/g; # sub's on $text $assign = s/Apple/Mango/g; # sub's on $_ and yields num of success say '$text: ', $text, "\t", '$assign: ', $assign, "\t", '$_: ', $_; };