Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2016-06-29 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (384 votes). Check out past polls.