Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Hashing: Argument "" isn't numeric in sort

by Joost (Canon)
on May 20, 2003 at 15:16 UTC ( [id://259479]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Hashing: Argument "" isn't numeric in sort
in thread Hashing: Argument "" isn't numeric in sort

It's quite impossible to change a hash-key, they are constant strings - strictly speaking they cannot even be numbers.

The string "465.274" is converted to a number when needed by perl, so that should not give you this warning, as the following code shows:

#!/usr/bin/perl -wl use strict; my @array = qw(465.274 21893.32 72.37); # qw creates quoted strings print for (sort {$a <=> $b} @array);

output:

72.37 465.274 21893.32

No warnings at all.

Joost

-- #!/usr/bin/perl -np BEGIN{@ARGV=$0}s(^([^=].*)|=)()s; =Just another perl hacker\

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-26 08:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found