and it worked just fine.sub doStuff { my $toggle = initToggle( 1 ); blah($toggle); } sub blah { my $t = shift; for ( 1..6 ) { print &$t . "\n" } }
Are you doing something differently than the above? Are you storing your code ref as the key in a hash, then pulling it back out and trying to use it again? If so the ref will be stringified and thereafter useless as a code ref. In fact, any stringification of your reference will render it unusable.
In reply to Re: Closures question
by btrott
in thread Closures question
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |