in reply to Array splice ??

Well, your call to Data::Dumper is missing, so it's very hard to say anything about it.

But this looks wierd:

push (@temp, $hash); push @lookup, @temp;

That happens in a loop. Inside the loop, @temp isn't cleared. So, if you go through the loop twice, the first hash will pushed to @lookup twice. If you go three times through the loop, in total 6 times a hash will be pushed on @lookup, in the order: 1, 1, 2, 1, 2, 3. And after a fourth iteration, @lookup will have: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4 as pushed hashes. Unless you have lines matching "Date", then $hash is pushed an extra time on @temp.

Oh, to further complicate things, there's just one $hash. Nothing local or lexical to the loop.

Abigail

Replies are listed 'Best First'.
Re: Re: Array splice ??
by crouchingpenguin (Priest) on Feb 26, 2003 at 17:24 UTC

    Abigail is right, your Data::Dumper call is missing from your post... you might also try the following method to dump your data:

    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array = qw( test this now); my %hash = ( one => 1, two => 2); print Data::Dumper->Dump([\%hash, \@array], [qw(*hash *array)]);

    cp
    ---
    "Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."