in reply to Hashing: Argument "" isn't numeric in sort
The <=> operator only works in numeric context. You need the cmp operator instead, which works in string context:
foreach $keyOut (sort {$a cmp $b} keys %hshOut) { ... }
Alternative: use Data::Dumper to dump your hash (assuming you're doing this for debugging purposes and not dumping it for user-viewable data).
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Hashing: Argument "" isn't numeric in sort
by P0w3rK!d (Pilgrim) on May 20, 2003 at 14:56 UTC | |
by Joost (Canon) on May 20, 2003 at 15:16 UTC |