[Chicago-talk] ok im feeling a bit (lot) retarted

Jim Thomason jthomasoniii at yahoo.com
Wed Apr 21 14:11:52 CDT 2004


Let's see if I can debug on the fly w/out testing
it...

If that's your input line, then note that it has regex
special characters in it, and they're being treated as
such.
So it's matching "Address_V1" OR an emptry string OR
"FromAddr" OR an empty string OR "315 Benjamin Lane"
OR ....

The first thing it happens to hit is "Address_V1", so
it successfully changes that to Address_V2.

Changing your delimiters away from pipes would yield
more expected results. Alternatively, it'd probably be
good to quote the string first.

s/\Q$_\E/Address_V2/;

To keep those metacharacters from having special
meaning.

-Jim.....

--- "Dooley, Michael" <Dooley.Michael at con-way.com>
wrote:
> while (<HANDLE>) {
>         if ($. == 2) {
>                 s/$_/Address_V2/;
>                 print "$_";
>         }
> }
> 
> ORIG
> Address_V1||FromAddr||||315 Benjamin
> Lane||||Boise||ID||USA||83704
> 
> NEW
> Address_V2||FromAddr||||315 Benjamin
> Lane||||Boise||ID||USA||83704
> 
> It is what I wanted but I just cant see why it is
> doing it.
> I mean why is it not substitueing the whole line w/
> just "Address_V2"?
> I didn't tell it to keep the rest of the line
> contents. Heck I didn't
> even specify what it should match. but it understood
> to swap out
> Address_V1 with Address_V2 and continue to print out
> the full line.
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk



	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash



More information about the Chicago-talk mailing list