in reply to Re^2: Why does this sub grab the whole hash
in thread Why does this sub grab the whole hash
@dr is not lexically scoped. The result is that each time the sub is called, unless you're reinitializing it somewhere that we're not seeing, @dr still has cruft in it from previous calls to the subroutine. It probably needs to be declared as my @dr.
$done is also not lexically scoped, but that's not as important as you're doing an assignment to it rather than an append. push is like an append for an array. If the array already has junk in it, you're just adding to what's already there.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Why does this sub grab the whole hash
by naturalsciences (Beadle) on Nov 11, 2011 at 18:29 UTC | |
by moritz (Cardinal) on Nov 11, 2011 at 18:32 UTC | |
by AnomalousMonk (Archbishop) on Nov 11, 2011 at 20:39 UTC | |
|
Re^4: Why does this sub grab the whole hash
by naturalsciences (Beadle) on Nov 11, 2011 at 18:23 UTC |