Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Which blatantly refuses to work. I've used a similar technique before, but that was with a straight hash, not a reference to a hash? Does it make a difference??... my $csv = Text::xSV->new(); my %results; my $count; $csv->bind_header(); while ($csv->get_row()) { @row =$csv->extract(@headers); $results{$count++} = [ @row ] unless ($notfound); } $self->{results} = \%results; ... my $results = $self{results}; foreach (sort { return $$results{$a}[0] <=> $$results{$b}[0]; } ke +ys %$results) { for (my $i=0; $i<@$headers; $i++) { print $$results{$_}[$i]."\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pingu can't sort a hash
by jarich (Curate) on Nov 25, 2001 at 08:54 UTC | |
|
Re: Pingu can't sort a hash
by dvergin (Monsignor) on Nov 25, 2001 at 09:19 UTC | |
|
Re: Pingu can't sort a hash
by seanbo (Chaplain) on Nov 27, 2001 at 21:04 UTC | |
|
Re: Pingu can't sort a hash
by Pingu (Sexton) on Nov 30, 2001 at 19:34 UTC |