Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Merging an array into an AoH

by geekgrrl (Pilgrim)
on May 21, 2004 at 20:39 UTC ( #355457=note: print w/replies, xml ) Need Help??


in reply to Merging an array into an AoH

Are those ids unique? They look like it. If so, I think a hash of hashes would be a better data structure for your problem.
my $box = { q01 => {}, ... q03 => {} }; #this should keep them in the right order my @sorted_keys = sort {lc $a cmp lc $b} keys %{$box} ; for my $id (@sorted_keys) { $box->{$id}{value} = shift @results; }

Replies are listed 'Best First'.
Re: Re: Merging an array into an AoH
by neniro (Priest) on May 21, 2004 at 20:53 UTC
    I prefer an AoH, cause I can use them directly within HTML::Template. The solutions above ar quite cool, especially BrowserUKs.
    Thanks a lot!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-08-14 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?