> > [using map to transform an old array to a new array
> >  leaving the old one unchanged?]
> 
> Here's my best shot:
> 
>     map { my $foo = $_; $foo =~ s/qux/waldo/ and $foo } @bar;

Fwiw, I just thought of a more brief and elegant way:

    @newarray = map { local $_ = $_; s/foo/bar/; $_ } @oldarray;

Reply via email to