Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 meditating upon the Monastery: (12)
As of 2014-12-25 04:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (159 votes), past polls