![]() |
|
No such thing as a small change | |
PerlMonks |
Re: Iterator to parse multiline string with \\n terminatorby Laurent_R (Canon) |
on Oct 06, 2013 at 08:58 UTC ( #1057130=note: print w/replies, xml ) | Need Help?? |
Hi, as a side note, your anonymous function does not really act as a closure:
because you are passing $fh each time to the sub (and you have to, you actually get a fresh copy of $fh each time the anonymous subroutine is called). If you want it to act as a closure, you may do something like this (untested):
Now, $fh is really a persistent variable within the sub scope, this is a real closure.
In Section
Seekers of Perl Wisdom
|
|