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

Re: hash sorting problems

by satchboost (Scribe)
on Apr 20, 2001 at 21:42 UTC ( [id://74247]=note: print w/replies, xml ) Need Help??


in reply to hash sorting problems

Ok..... First off, your sort should be something along the lines of sort {$a <=> $b} (keys %sentence_count). (This is known as the spaceship operator.)

My main question, though, is where are you putting the result of the sort?? You have the line (as I read it):
$sentence_count{($Counter)} = $sentence_count{($Counter)}sort by_num (keys (%sentence_count));

This line doesn't make much sense to me. Update your node with the code reformatted, please.

Replies are listed 'Best First'.
Re: Re: hash sorting problems
by little (Curate) on Apr 20, 2001 at 22:20 UTC
    ok, look up perlfunc:sort and read about user defined sorting criteria.

    Have a nice day
    All decision is left to your taste

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-25 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found