in reply to Re^2: Joining Arrays?
in thread Joining Arrays?

I agree with that. It would be nice if map (and grep) could take a variable like foreach does.

# this doesn't work my @joined = map my $url { map my $code { $url . $code } @codes } @urls;

Replies are listed 'Best First'.
Re^4: Joining Arrays?
by pobocks (Chaplain) on Dec 21, 2008 at 06:07 UTC

    I guess, but I actually find that version harder to read than the first version. For one thing, it has no indentation options that aren't kind of terrible.

    For the general, non-nested versions, it might be nicer.

    for(split(" ","tsuJ rehtonA lreP rekcaH")){print reverse . " "}print "\b.\n";
Re^4: Joining Arrays?
by pKai (Priest) on Dec 21, 2008 at 17:26 UTC

    If the map BLOCK is more complicated than [insert personal threshold here], or they are nested I just declare the variable myself.

    @joined = map { my $url = $_; map { my $code = $_; $url . $code; } @codes } @urls;