Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Sorting hash

by Punitha (Priest)
on Feb 21, 2008 at 11:59 UTC ( #669252=note: print w/replies, xml ) Need Help??


in reply to Sorting hash

Hi vsailas,

You can try like this by modifying your array(@Data) to little bit as,

use strict; my @Data; while(<DATA>){ chomp($_); my($string,$listref,$count)= split(',' , $_); push(@Data,[$string,$listref,$count]); } print "METH:$_->[0]\tREF:$_->[1]\tCOUN:$_->[2]\n" for sort {$a->[0] cm +p $b->[0]} @Data;


__DATA__ meth2, \@array1, 3 meth3, \@array2, 36 meth1, \@array3, 8 meth5, \@array4, 10

Punitha

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://669252]
help
Chatterbox?
[james28909]: foreach server this bot is on, the gateway sends me a json response, which i parse out all the info with JSON, and this response has user information, i need to be able to add a user, and then update the user info when they join/leave rooms ect
[james28909]: i think im good
[james28909]: i just watched a youtube video
[karlgoethebier]: james28909: Did you look on CPAN?
[james28909]: lol
[karlgoethebier]: james28909: Super Search here ?
[karlgoethebier]: james28909: No kidding

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2017-05-25 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?