Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^5: Sorting integer value hash keys

by ikegami (Patriarch)
on Dec 25, 2009 at 20:01 UTC ( #814372=note: print w/replies, xml ) Need Help??

in reply to Re^4: Sorting integer value hash keys
in thread Sorting integer value hash keys

I think that you're mistaken—say (as opposed to print) provides it for me.

Oops, right

but then I would have had to point out that sort { $a <=> $b } 1..10 could be replaced by just 1..10,

That wouldn't demo how to sort 10 after 9 rather than before 2.

That wasn't my goal, largely because I'm not sure what you mean.

The OP suspected that hashes keys are always strings and that stringification of the keys was the cause of his problem.

Hash keys are always strings (except for magical hashes), but that's not the cause of his problem. Perl treats the number zero and the string zero identically (except for its bitwise operators).

(I'm sure you know that. It's for the OP's benefit.)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-01-30 23:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found