On Oct 30, 7:50 am, [EMAIL PROTECTED] (Paul Lalli) wrote:
> On Oct 30, 9:38 am, [EMAIL PROTECTED] (Ron Bergin) wrote:
>
> > > On 10/30/07, howa <[EMAIL PROTECTED]> wrote:
>
> > > > Consider the example below...
>
> > > > Config.pl
> > > > ======
>
> > > > #!/usr/bin/perl -w
>
> > > > my $value = "abc";
> > In addition to changing 'my' to our' in Config.pl, you'll also need to
> > add the 'our $value;' to Script.pl
>
> Blatantly untrue.  The OP was not using strict.  'our' is only
> required to be able to refer to global variables without qualifying
> them when strict 'vars' is in use.  If there is no strict, 'our' is a
> no-op.
>
> Paul Lalli

I wouldn't say that it was "Blatantly untrue".  However, I did neglect
to include my normal qualification instructing the person to always
use the strict and warnings pragmas like I did in the optional method
that I posted.  With the inclusion of the strict pragma, then the use
of 'our' in Script.pl would be needed.

The OP didn't show us the shebang for the Script.pl, but since the -w
switch is being used in Config.pl, it's a fair assumption that it's
being used in Script.pl.  Assuming that to be true, failing to use
'our' in Script.pl will generate the following warning.

Name "main::value" used only once: possible typo at ....


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to