Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: difficulty in multi sorting

by pelagic (Curate)
on May 19, 2005 at 06:34 UTC ( #458534=note: print w/ replies, xml ) Need Help??


in reply to difficulty in multi sorting

texuser74,
you probably want to get the data into some structure before processing it. So why don't you read through your file and 'feed' a Hash of Array in a way like:

... my %hash; while (<IN>) { my $name = ... my $code = ... push @{ $hash{$name} }, $code; }
Then you can loop through the sorted hash keys and print the name together with all it's (sorted) codes.
foreach my $name (sort keys %hash) { print join (', ', $name, sort @{ $hash{$name} }), "\n"; }
That's some sort of pseudo code, so it will not work as is. .. ;)

pelagic


Comment on Re: difficulty in multi sorting
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (17)
As of 2014-08-29 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (280 votes), past polls