That doesn't mean you can't use a push, just that you don't have to to make one list:my @times_two = map { $_ * 2 } (1 .. 12);
my @duplicate; my @times_two = map { my $val = $_ * 2; push @duplicate, $_; $_ } (1 . +. 12);
Does that make it clearer?
In reply to Re: Re: Re: Re: foreach/map equivalency
by chromatic
in thread foreach/map equivalency
by rob_au
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |