Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: changing package variables?

by LameNerd (Hermit)
on Mar 05, 2003 at 00:06 UTC ( #240491=note: print w/replies, xml ) Need Help??

in reply to Re: changing package variables?
in thread changing package variables?

I was under the mistaken impression that doing
  use MYPACKAGE qw / sub1 /;
  use vars qw / $var1 /;
Would give me instance of $MYPACKAGE::var1 in my main package scope.
So what's the diffence between
  use vars qw / $var1 /;
  my $var1
?????? What was I thinking?

Replies are listed 'Best First'.
Re: Re: Re: changing package variables?
by arturo (Vicar) on Mar 05, 2003 at 15:55 UTC

    In a nutshell :my does not declare a package variable. use vars does. There's a wealth of information on this topic in the Tutorials section of the site (subsection "variables"); I'll plug my Variable Scoping in Perl: the basics and Dominus' Coping With Scoping specifically.

    update adjusted the link to CwS to point directly to it.

    If not P, what? Q maybe?
    "Sidney Morgenbesser"

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://240491]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2023-09-25 03:11 GMT
Find Nodes?
    Voting Booth?

    No recent polls found