[EMAIL PROTECTED] wrote:
> Er, aren't hash keys interpreted as strings, even if they contain
> digits? 

Perl does not have a strict distinction between string and numeric
data.  They are both considered scalars.  The difference comes in how
you use the scalar value.

Try this:

    $a = "10";
    $b = "2";
    
    if ($a < $b) {
        print "numeric: $a is less than $b\n";
    }
    else {
        print "numeric: $b is less than $a\n";
    }
    
    if ($a lt $b) {
        print "string: $a is less than $b\n";
    }
    else {
        print "string: $b is less than $a\n";
    }

Output is:

    numeric: 2 is less than 10
    string: 10 is less than 2

-- 
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to