Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
maybe haukex understood your problem and you need to get acquainted with dynamic-scoping ... which is the only possible way to have limited control over global variables.
NB: our package-vars and special vars like $1 are global. They are accessible everywhere at run-time and prone to "sabotage". Static aka lexical scoping is a totally different beast for my vars at compile-time. Try to debug a global variable which suddenly changes after you called a sub from a foreign module you just upgraded. And special vars are not protected by namespaces, they are all in main:: ! That's why they are automatically localized in subs. Dynamic scoping was already a given in Perl4, which had no such thing like my or lexical scoping.
Cheers Rolf In reply to Re^3: why is $1 cleared at end of an inline sub?
by LanX
|
|