Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Sorting an array or hashes

by hok_si_la (Curate)
on Jan 24, 2012 at 18:02 UTC ( #949738=note: print w/ replies, xml ) Need Help??


in reply to Re: Sorting an array or hashes
in thread Sorting an array or hashes

Thanks for the help Corion. I cleaned up my code a bit and used the following to print sorted elements of my AoH (@collectionData):

foreach $j (@sortedCollectionData) { my ($longStatus, $rowStyle, $rowColor); $longStatus = $translateLongStatus{ $collectionData[$j]->{Status} +} ||'Submitted Complete'; if (($i%2) == 0){ $rowStyle = "oddrow"; $rowColor = "#e5e5e5"; } else { $rowStyle = "evenrow"; $rowColor = "#ffffff"; } print qq{ <tr class=$rowStyle style=Cursor:hand onclick= \"location.href=\'get +Collection.pl?id=$collectionData[$j]->{CollectionId}\';\" onMouseOver +=\"style.backgroundColor='#c5c5c5'\" onMouseOut=\"style.backgroundCol +or='$rowColor'\"> <th class=graycenter>$collectionData[$j]->{'CollectionId'}</th> <th class=graycenter>$collectionData[$j]->{'Framecount'}</th> <th class=graycenter>$collectionData[$j]->{'Missing'}</th> <th class=graycenter>$longStatus</th> <th class=graycenter>$collectionData[$j]->{'Modified'}</th> </tr> };


Comment on Re^2: Sorting an array or hashes
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (18)
As of 2015-07-02 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (38 votes), past polls