http://qs321.pair.com?node_id=11119192


in reply to Re: Expression form of map or grep
in thread Expression form of map or grep

I think @list will not contain anything from @grey_scale, and would warn with something like "Useless use of private array in void context" ...

Ah, good catch!

c:\@Work\Perl\monks\Lady_Aleena>perl -wMstrict -MData::Dump -le "my @colors = qw(a b c); my @grey_scale = qw(x y); my @list = map( qq{$_ beads}, @colors ), @grey_scale; dd \@list; " Useless use of private array in void context at -e line 1. ["a beads", "b beads", "c beads"]
Another set of parentheses is needed to include the second (and any subsequent) array:
c:\@Work\Perl\monks\Lady_Aleena>perl -wMstrict -MData::Dump -le "my @colors = qw(a b c); my @grey_scale = qw(x y); my @list = (map( qq{$_ beads}, @colors ), @grey_scale); dd \@list; " ["a beads", "b beads", "c beads", "x", "y"]


Give a man a fish:  <%-{-{-{-<