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:

The following script attempts to illustrate each of the points above.
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", '$_: ', $_ +; };
I'm not the guy you kill, I'm the guy you buy. —Michael Clayton

Replies are listed 'Best First'.
Re^2: Search and replace problem
by Thakur (Acolyte) on Jan 12, 2012 at 18:19 UTC

    Thanks a lot Xiong. I learned a lot from your reply.

      Glad to help.

      I'm not the guy you kill, I'm the guy you buy. —Michael Clayton