Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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.


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

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 perusing the Monastery: (6)
As of 2014-12-22 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (111 votes), past polls