LameNerd has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks,
I have this package:
in my script?
I have this package:
Now I use this packe in this script like so:package MYPACKAGE; use Exporter; use vars qw / $VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS /; $VERSION = 1.0; @ISA = qw/ Exporter /; @EXPORT = (); @EXPORT_OK = qw / sub1 /; %EXPORT_TAGS = ( DEFAULT => [ qw / sub1 / ] ); use strict; my $var1 = "DEFUALT I WANT TO CHANGE"; sub sub1 { print "var1 = $var1\n"; } 1;
The output is:#!/usr/bin/perl -w use strict; use lib ('.'); use MYPACKAGE qw / sub1 /; use vars qw / $var1 /; $var1="PRINT THIS"; sub1();
var1 = DEFUALT I WANT TO CHANGEI was hoping that the output would be
var1 = PRINT THISHow come the value of $var1 didn't change when I did $var1="PRINT THIS";
in my script?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: changing package variables?
by tachyon (Chancellor) on Mar 04, 2003 at 23:58 UTC | |
by LameNerd (Hermit) on Mar 05, 2003 at 00:11 UTC | |
Re: changing package variables?
by jasonk (Parson) on Mar 04, 2003 at 23:50 UTC | |
by LameNerd (Hermit) on Mar 05, 2003 at 00:06 UTC | |
by arturo (Vicar) on Mar 05, 2003 at 15:55 UTC | |
Re: changing package variables?
by BrowserUk (Patriarch) on Mar 05, 2003 at 00:14 UTC |
Back to
Seekers of Perl Wisdom