I don't know about efficiency, but this is pretty confusing:
my $sth = $dbh->prepare($sql_last); # ... while (my $pointer = $sth->fetchrow_hashref){ my $sql_back = '...'; my $sth = $dbh->prepare($sql_back); while (my $pointer = $sth->fetchrow_hashref){ # ... my $sth = $dbh_2->prepare($sql_net); # ...
The rules of lexical scoping make this all work, but I highly recommend that each $sth and $pointer (which would be more accurately, but no more descriptively, called $hash_reference) have their own name. If you use warnings (and I recommend that too), these things will toss out messages like "my" variable $x masks earlier declaration in same scope.
Does this actually hang, or just take a long time? Adding some print statements in your loops might help you see what it's doing. For general efficiency tuning, I recommend Profiling your code.
In reply to Re: Perl Code Efficiency Issue
by kyle
in thread Perl Code Efficiency Issue
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |