Thanks a million to Jos Boumans, and Me (whoever that is). Me, thanks for
the explanation, and Jos, for your patient and detailed answer.
-tir
On Sat, 16 Jun 2001, Me wrote:
> > This should've worked. But why do I get a warning:
> >
> > Use of uninitialized value at ./mk2_ratingchangedb.p
> This should've worked. But why do I get a warning:
>
> Use of uninitialized value at ./mk2_ratingchangedb.pl line 39,
chunk 8.
Whenever you're dealing with baffling array errors
like this, always think of off-by-one.
In this case:
> 30 for ($i=1; ...) {
> 31 $dummy[$i][
same applies here again. this is the trick used:
we dig out that value we want to sort on, make that the key of our hash and
go from there
let me adres the @arr you presented.
### EXAMPLE 1 ###
### this will NOT eliminate the value we're sorting on from the list ###
while ( my @s = splice(@a
Thnaks a lot Jos. The idea of reading the array into a hash is quite appealing, and
simple too. But I have a small problem with this:
What if I want to sort on the second column of the array? Or if there are more
than two columns?
Say we have:
my @arr = qw(
1 2 3 4
4 5 6 7
5 6 7 8
1 2 3 4
3
ok, so if i get this right, @dummy has the following format:
my @dummy = qw(
1996013100:00:00MAAA
281100:00:00MA-
1997063000:00:00MAAA
1998122200:00:00MAA
2000112400:00:00MD
);
now we have that established, let'
Folks,
# How do I sort an array by one of it's fields?
I have a this code:
for ($i=1; $i<=$N; $i++) { }
$dummy[$i][0] = &ParseDate($data{$key}[$i][0]);
if (! $dummy[$i][0]) { }
warn "Could not parse $data{$key}[$i][0]\n";
}
$dummy[$i][1] = $da