Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: one-liner to merge arrays (Re: A C-like brain in a Perl-like world)

by extremely (Priest)
on Sep 27, 2001 at 23:42 UTC ( [id://115222]=note: print w/replies, xml ) Need Help??


in reply to one-liner to merge arrays (Re: A C-like brain in a Perl-like world)
in thread A C-like brain in a Perl-like world

Lets look at it blown out:
= values %{{ map {$_ => $_ } @a,@b }} ; = values # I want a hash and return a list %{ } # I turn a hashref into a hash { } # I turn a list into a hashref map { } @a,@b # I return a list from a list => , # We construct lists

HTH...

--
$you = new YOU;
honk() if $you->love(perl)

Replies are listed 'Best First'.
Re: Re: one-liner to merge arrays (Re: A C-like brain in a Perl-like world)
by andye (Curate) on Sep 28, 2001 at 15:09 UTC
    Thanks extremely and jeffa, it's all clear now.

    I should have realised, since the array equivalent would be @{[  ...  ]} , that the brackets were doing different things - but I'd managed to confuse myself.

    Cheers,
    Andy.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-28 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found