![]() |
|
Think about Loose Coupling | |
PerlMonks |
Re: changing package variables?by tachyon (Chancellor) |
on Mar 04, 2003 at 23:58 UTC ( #240489=note: print w/replies, xml ) | Need Help?? |
Remove the my declaration and use vars to declare $var1 in your package and export $var1 and it will work.
The OO way to do it is with get and set methods. The advantage of this is that a my var can not be accessed* outside the package so the only way to get/set the value is using the accessor methods. These can be useful as you can ensure that only valid values are set.
cheers tachyon s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In Section
Seekers of Perl Wisdom
|
|