Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by P0w3rK!d (Pilgrim)
on May 20, 2003 at 14:56 UTC ( #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
  • 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\

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2019-12-11 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?