Philip Newton wrote:
> > What you've written above, would I have written as
> > @foo = map { s/\s+/ /g } @bar;
> 
> $_ is an alias to the original values inside map and grep, so your code
> above would have modified @bar. An equivalent using map might be
> 
>     @foo = map { my $x = $_; $x =~ s/\s+/ /g; $x; } @bar;
> 
> , but that's more typing. As Brian said, it's possible to provide the
> same functionality already; 'apply' just saves you some typing.
> 
Cool :-)

Andrea

Reply via email to