Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by P0w3rK!d (Pilgrim)
on May 20, 2003 at 14:56 UTC ( [id://259474]=note: print w/replies, xml ) Need Help??


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

The keys look something like 465.274. The keys used to be numeric and then they became strings. Thanks for catching this for me.
-P0w3rK!d

Replies are listed 'Best First'.
Re: Re: Re: Hashing: Argument "" isn't numeric in sort
by Joost (Canon) on May 20, 2003 at 15:16 UTC
    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://259474]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2024-03-28 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found