> What I was looking for is a way to take an
> element from @foo - change it in some way,
> and place it in @bar without changing the
> original element of @foo.... but do it in one
> line of code:

Well, I'd still be inclined to do something like:

    @foo = @bar; for (@foo) { s/qux/waldo/ };

even if that isn't one statement as you probably meant.

But perhaps @bar is large enough and performance
requirements tight enough that you need to have @foo
only contain changed elements.

And you want it in one simple statement? I don't think
it can be done, depending on one's definition of simple.

Here's my best shot:

    map { my $foo = $_; $foo =~ s/qux/waldo/ and $foo } @bar;



Reply via email to