memnoch has asked for the wisdom of the Perl Monks concerning the following question:
and put the following in "junk.pl":package Mylib; use strict; use warnings; our $variable1 = "string1";
it seems from the above article that I should be able to access $variable1 without the "Mylib::" package name....but when I check the syntax, I get the following:use lib 'F:/scripts/perl/'; use junk; use strict; use warnings; print("\$variable1 = $variable1\n");
Any idea where my thinking or implementation is wrong? Thank you, memnochF:\scripts\perl>perl -c junk.pl Global symbol "$variable1" requires explicit package name at junk.pl l +ine 10. junk.pl had compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use "our()" variables correctly within a Perl module
by ikegami (Patriarch) on Nov 27, 2007 at 15:52 UTC | |
by memnoch (Scribe) on Nov 27, 2007 at 16:00 UTC | |
|
Re: How to use "our()" variables correctly within a Perl module
by moritz (Cardinal) on Nov 27, 2007 at 15:47 UTC | |
by memnoch (Scribe) on Nov 27, 2007 at 15:58 UTC | |
|
Re: How to use "our()" variables correctly within a Perl module
by shmem (Chancellor) on Nov 27, 2007 at 20:26 UTC | |
by memnoch (Scribe) on Nov 27, 2007 at 21:04 UTC | |
by shmem (Chancellor) on Nov 27, 2007 at 21:25 UTC | |
by memnoch (Scribe) on Nov 28, 2007 at 13:23 UTC |