> why I am unable to print the value of the main
package's variable (despite that I am using the fully qualified variable
name)?

Name "main::var" used only once: possible typo at C:\perlsrc\TEST.PL line
9.

Use of uninitialized value in concatenation (.) or string at
c:\perlsrc\TEST.PL line 9.


Hmm, this:
use strict;
use warnings;

our $var = "value";

works as expected. 'my' is the lexicalizer, so it appears it *doesn't* put
the var into the main package. Something like lexical vars *can't* be
package scope/FQVNamed, only 'our' vars can. Try 'perldoc our':
               An "our" declares the listed variables to be valid globals
within the enclosing block, file, or "eval".  That is, it has the same
scoping rules
as a "my" declaration, but does not create a local variable.  If more than
one value is listed, the list must be placed in parentheses.  The "our"
declaration has no semantic effect unless "use strict vars" is in effect,
in which case it lets you use the declared global variable without
qualifying it with a package name.  (
But only within the lexical scope of the "our" declaration.  In this it
differs from "use vars", which is package scoped.)

               An "our" declaration declares a global variable that will be
visible across its entire lexical scope, even across package boundaries.
The package in which the variable is entered is determined at the point of
the declaration, not at the point of use.  This means the following
behavior holds:

a

-------------------
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
Voice: (608) 261-5738 Fax: 264-5932

The name "grep" is from the common "ed" (pre-visual "vi") command:
 g/re/p i.e. g(lobal-search)/r(egular) e(xpression)/p(rint)

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to