in reply to Re^8: Is it possible to create a sub exclusive to a sub?
in thread Is it possible to create a sub exclusive to a sub?
Also, that doesn't work.
#! perl -l use strict; use warnings; sub test{ our $test{localsub} = sub{ print 'localsub1'; return 12345; } unless exists $test{localsub}; $test{localsub}->(); } print test; __END__ P:\test>junk syntax error at P:\test\junk.pl line 6, near "$test{localsub" Execution of P:\test\junk.pl aborted due to compilation errors.
It would have to become:
#! perl -l use strict; use warnings; sub test{ our %test; $test{localsub} = sub{ print 'localsub1'; return 12345; } unless exists $test{localsub}; $test{localsub}->(); } print test;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Is it possible to create a sub exclusive to a sub?
by Aristotle (Chancellor) on Sep 19, 2004 at 11:54 UTC |