Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Appending one array onto another

by Skeeve (Parson)
on Jun 10, 2003 at 09:18 UTC ( #264581=note: print w/replies, xml ) Need Help??


in reply to Appending strings from one array onto strings of another

And here are my 2 Euro-Cent
@z=map{$_.$d[-1+push@d,shift@d]}@z;
Update: One can use a side-effect and avoid the assignment of an array:
map{$_.=$d[-1+push@d,shift@d]}@z;

Replies are listed 'Best First'.
Re: Re: Appending one array onto another
by sauoq (Abbot) on Jun 10, 2003 at 09:33 UTC

    And using aliasing to our advantage but avoiding map in void context yields

    $_ .= $d[-1 + push @d, shift @d] for @z;
    I'm not convinced that it's at all better than the first one in the OP though. This is a bit obscure for no really good reason.

    -sauoq
    "My two cents aren't worth a dime.";
    
      I like that one!

      It's obscure, yes. But not for "no really good reason" but for avoiding an aditional variable. But now as I think of it ;-) Okay: It's no really good reasone. Maybe I should think about my taking part in perl-minigolf and obfuscation.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264581]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2020-07-14 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?