in reply to Re^7: Is it possible to create a sub exclusive to a sub?
in thread Is it possible to create a sub exclusive to a sub?
Maybe you missed the fact that the first two of the messages you got were merely non-fatal warnings, and that all three of them did not happen until runtime. The message I got was compile time. Why are you using strict at all, if these arguments don't hold any weight with you?
If distant declarations bother you, use our.
#!/usr/bin/perl -l use strict; use warnings; sub test{ our %test; $test{localsub} = sub{ print 'localsub1'; return 12345; } unless exists $test{localsub}; $tset{localsub}->(); } print test; __END__ Global symbol "%tset" requires explicit package name at t.pl line 12. Execution of t.pl aborted due to compilation errors.
Update: I wrote our $test{localsub} = # ... at first, which is clearly wrong.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Is it possible to create a sub exclusive to a sub?
by BrowserUk (Patriarch) on Sep 19, 2004 at 11:47 UTC | |
by Aristotle (Chancellor) on Sep 19, 2004 at 11:54 UTC | |
|
Re^9: Is it possible to create a sub exclusive to a sub?
by ihb (Deacon) on Sep 19, 2004 at 12:06 UTC | |
by Aristotle (Chancellor) on Sep 19, 2004 at 13:19 UTC | |
|
Re^9: Is it possible to create a sub exclusive to a sub?
by BrowserUk (Patriarch) on Sep 19, 2004 at 11:39 UTC | |
by Aristotle (Chancellor) on Sep 19, 2004 at 11:50 UTC |