Yes, exactly. To elaborate on Anonymous Monk’s answer:
12:41 >perl -Mstrict -wE "package myPackage; sub function1 { myPackage +::function2('Hi!'); } sub function2 { say qq[@_]; } function1();" Hi! 12:41 >perl -Mstrict -wE "package myPackage; sub function1 { function2 +('Hi!'); } sub function2 { say qq[@_]; } function1();" Hi! 12:41 >perl -Mstrict -wE "package myPackage; sub function1 { myPackage +->function2('Hi!'); } sub function2 { say qq[@_]; } function1();" myPackage Hi! 12:41 >
Within the package, prepending myPackage:: to a function name is merely redundant. But prepending myPackage-> changes the behaviour: it passes the package name to the function as the first argument.
Hope that helps,
Athanasius <°(((>< contra mundum
In reply to Re: Using functions from their own package
by Athanasius
in thread Using functions from their own package
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |