in reply to Ghostly subroutine variables haunting me in subsequent calls
Add use strict;to your code and it will tell you why.
Specifically, the array that you use to return the results of your function to the caller @pileofinchis is never declared lexically (with my), and so you are (re-)using the same global array each time you call the function. As you only ever add values to the array
push @pileofinchis,$localinchi;
The contents of the array are added to, but never removed, each time you call it.
use strict catches these things for you and saves much time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Ghostly subroutine variables haunting me in subsequent calls
by blazar (Canon) on Oct 25, 2005 at 17:40 UTC | |
by BrowserUk (Patriarch) on Oct 25, 2005 at 18:32 UTC |