in reply to Scalar Value Not Available To Subroutine
The code below prints the uid as expected from within the foreach loop. However, it will not print it in the subroutine. Why not and how can I fix it?
The reason is that the foreach loop localises $uid; but the subroutine mail closes over the variable declared above and outside the foreach loop, which is never initialised or assigned to.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Scalar Value Not Available To Subroutine
by tobyink (Canon) on Dec 20, 2012 at 17:42 UTC | |
by BrowserUk (Patriarch) on Dec 20, 2012 at 18:04 UTC | |
by ikegami (Patriarch) on Dec 21, 2012 at 05:41 UTC | |
by LanX (Saint) on Dec 20, 2012 at 19:06 UTC | |
by ikegami (Patriarch) on Dec 21, 2012 at 05:38 UTC |