: redsquirreldesign [SMTP:[EMAIL PROTECTED]]
Sent: 26 June 2001 14:50
To: Bedish, Mark; beginners
Cc: redsquirreldesign
Subject: Re: sort by value?
Mark Bedish wrote:
> Dave,
>
> >It looks to me that your hash %ch is empty. Your
> >foreach will never begin because there is no list
> to
>
Dave,
>It looks to me that your hash %ch is empty. Your
>foreach will never begin because there is no list to
>iterate. You need to assign keys & values to %ch.
>When it is time to sort numerically, use the spaceship
>operator <=>. So it would look like this:
>sort { $ch{1} <=> $ch{2} }
No
@fields = qw/Text Time/;
my %ch;
foreach my $key (sort { $ch{1} cmp $ch{2} } keys %ch ) {
print OUT "$key: $ch{$key} \n"; # show key and value
}
Thanks,
Mark Bedish
in for this type of
processing, but VB is the standard so I have an uphill struggle :-(
Thanks again,
Regards
Mark Bedish
Surrey,UK
);
print LOG "Unpacked format for array: \n";
for $i (0..64) { print LOG $testbad[$i]; }
print LOG "\n";
for $i (0..64) {
if ($testbad[$i] == 13) { $testbad[$i] = 40; }
}
__SNIP__
Many Thanks,
Mark Bedish
Surrey,UK