Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Elegance, dammit!

by sfink (Deacon)
on Jun 16, 2007 at 21:10 UTC ( #621621=note: print w/ replies, xml ) Need Help??

in reply to Elegance, dammit!

Purely for completeness.

Option 1:

while (@ref) { my $k = shift(@ref); $out{$k} = [ shift(@ref), shift(@ref) ]; }
or if the temporary bothers you:
while (@ref) { $out{$_} = [ shift(@ref), shift(@ref) ] for shift(@ref); }

Option 2: Change your SQL to something like SELECT key, value1, key, value2, then do:

push @{ $out{shift(@ref)} }, shift(@ref) while (@ref);
Personally, I'd stick with your original.

Comment on Re: Elegance, dammit!
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2015-11-29 14:53 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls