>>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:

>>>>> "Robert" == Robert Hanson <[EMAIL PROTECTED]> writes:
Robert> You probably want to use "map".
Robert> This should work.

Robert> @body = map { s/foo/bar/; $_ } (@body);

Randal> No.  Please don't answer without testing.

Randal> That messes up @body as well, since $_ is an alias back into the
Randal> original list.

And of course, I need to read better. :)  I was thinking it was

  @new = map { s/foo/bar; $_ } @body;

So Robert's solution was just plain wierd, although it will do the
job.  It's a bit like saying "$a = $a = 3 + $b".  Why the second
assignment? :)

Randal> This works:

Randal>         s/foo/bar/ for @body;

Randal> presuming you have a reasonably modern Perl.

And can read your own handwriting. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to