perlplayer has asked for the wisdom of the Perl Monks concerning the following question:
i want to print the value from my package but not from main but it is not working can anyone explain why ... i have seen in perlmod that we define a sub in a different package if we explicitly declare its name with the package we intend to keep it in. OUTPUT#! /usr/bin/perl $var='one'; mypackage::var='two'; sub mypackage::func(){ print "my \$var is $var"; } mypackage:: func();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem ..related to perl package concept
by jasonk (Parson) on Dec 09, 2008 at 04:36 UTC | |
|
Re: problem ..related to perl package concept
by moritz (Cardinal) on Dec 09, 2008 at 07:44 UTC | |
|
Re: problem ..related to perl package concept
by Bloodnok (Vicar) on Dec 09, 2008 at 09:07 UTC | |
|
Re: problem ..related to perl package concept
by kyle (Abbot) on Dec 09, 2008 at 15:51 UTC |