in reply to Search and replace problem
I applaud your willingness to post an actual example script and actual example data. Please allow me to offer a number of points:
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 su +ccess say '$text: ', $text, "\t", '$assign: ', $assign, "\t", '$_: ', $_ +; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search and replace problem
by Thakur (Acolyte) on Jan 12, 2012 at 18:19 UTC | |
by Xiong (Hermit) on Jan 12, 2012 at 21:36 UTC |