in reply to Re^4: Is it possible to create a sub exclusive to a sub?
in thread Is it possible to create a sub exclusive to a sub?
Which strictures?
#! perl -slw use strict; sub test{ ## create a 'local' sub the first time we're called ## As many as you like each with it's own name *test->{localsub} = sub{ print 'localsub1'; return 12345; } unless exists *test->{localsub}; ## USE IT WRONG!! *test->{lacolsub}(); *tset->{localhost}(); } print test; __END__ P:\test>test Name "main::tset" used only once: possible typo at P:\test\test.pl lin +e 14. Use of uninitialized value in subroutine entry at P:\test\test.pl line + 13. Can't use string ("") as a subroutine ref while "strict refs" in use a +t P:\test\test.pl line 13.
|
|---|