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?
[marto]: well, their mother let them sleep till 15:00 & 12:00 last week, which didn't help them adjust :P
[Corion]: I was "productive" over the weekend in the sense that I revived my old "Perlmonks on SQLite" code, which likely means I can get a test instance back up running on my webhost. Small steps :)
[Corion]: marto: Ow, no, that doesn't help at all :)
[choroba]: Related to the new release, anyone could explain this or this tester report?
[Discipulus]: hello crew! marto thanks for the message: but I how can I help? i'm testing cpan Padre atm problem with Client::Debug
[choroba]: I don't happen to have 5.10.0 nor 5.8.5 handy...
[Corion]: Hmm - I would say the 5.8.5 is a broken installation / corrupt tarball download, and the 5.10.0 is really weird, and maybe a bug in that version of Perl

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2018-06-25 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?