> > [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;
- RE: map function has me confused Tom Watson
- Re: map function has me confused Me
- Re: map function has me confused Tom Watson
- Re: map function has me confused Michael Fowler
- Re: map function has me confused Randal L. Schwartz
- Re: map function has me confused Chas Owens
- Re: map function has me confused Randal L. Schwartz
- Re: map function has me confused Me
- Re: map function has me confused Jos I. Boumans
- Fw: map function has me confused Me
