>>>>> "Michael" == Michael Fowler <[EMAIL PROTECTED]> writes:

Michael> On Tue, Jun 12, 2001 at 05:56:17PM +0100, Tom Watson wrote:
>> I was thinking it might be possible to do this in one line using map......?

Michael> Well, there's:

Michael>     @new = map { my $tmp = $_; $tmp =~ s/foo/bar/; $tmp; } @original;


Michael> OR (this is bad form, you shouldn't use map in void context)

Michael>     map { s/foo/bar/ } (@new = @original);

For this, I much prefer:

        s/foo/bar/ for @new = @original;

And it's even less typing!

-- 
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!

Reply via email to