http://www.perlmonks.org?node_id=259474


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
  • Comment on Re: Re: Hashing: Argument "" isn't numeric in sort

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\