Exactly, because he wanted to be able to call his function using $func->() in package p2 just like in p1. I therefore showed how how to achieve both potentially desired results: being able to call his function like func() or by $func->() like he had in his code.
I wouldn't advocate either methods, but it's what he asked for.
In reply to Re^3: anonymous sub, packages, global variables
by wind
in thread anonymous sub, packages, global variables
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |