Mark Bedish wrote:
[snip]
> am I using the wrong approach entirely?
>
> my @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
> }
[snip]
Mark,
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} }
HTH
BTW, I got the sort answer from "Effective Perl
Programming" by Joseph Hall, a book I HIGHLY recommend
to beginners (such as myself) once they've worked
through the Llama and given the Camel a few tries.
=====
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/