Yup. I guess I shouldn't answer questions on the last hour of a busy work
week, but I'll give it another shot. I suppose you could try something
along these lines:
foreach(sort keys %$i){
push(@sorted,$_) unless /^I\d+$/;
}
foreach(sort keys %$i){
push(@sorted,$_) if /^I\d+$/;
}
now @sorted should have your keys sorted stringwise with the 'I' keys at the
end. I don't know if that's what you want, but it's an idea.
-----Original Message-----
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 10, 2003 5:06 PM
To: 'Yacketta, Ronald'
Cc: [EMAIL PROTECTED]
Subject: Re: hash sorting
Timothy Johnson wrote:
> Try using 'cmp' instead of '<=>' in your sort. Then it will sort
> alphanumerically.
>
This does not appear to help, perldoc perlop says:
"Binary "cmp" returns -1, 0, or 1 depending on whether the left argument
is stringwise less than, equal to, or greater than the right argument."
Which the 30-Dec-02 is still in the same order stringwise. Depending on
your database you may be able to fix this by specifying your query as
STARTDATE, SYSTEM, TYPE, *, and then not including the first 3 elements
in the print, or you could skip any non /I\d+/ keys in the hash and then
print them at the bottom. There should be a way to get sort to do it
correctly but this escapes me at the moment...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]