If it is not numeric, what do you want to do? If you want to bypass,
then could do something like:

my %MyData = qw( 1 10 2 15 d 9 10 5);

foreach my $MyKey (sort { $a <=> $b} grep(/^\d+$/, keys %MyData) ) {
    printf "%5d: %-s\n", $MyKey, $MyData{$MyKey};
 }

Output:
    1: 10
    2: 15
   10: 5

If you want to see the data, then you would need to explain what you want.

Wags ;)

-----Original Message-----
From: Balint, Jess [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 18, 2002 08:07
To: '[EMAIL PROTECTED]'
Subject: sorting Numeric OR Character data


Hello all. I have a small subfunction with a "for sort keys %hash" construct
in it. In my sort, I want to have { $a <=> $b } (numberic) sorting, but I
get errors when character data is entered. Is there anyway to tell numberic
vs character without looping through keys looking for m/\D/? Thanks.

jess

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to