|Perl Monk, Perl Meditation|
Global Variableby abithajames (Initiate)
|on Sep 22, 2008 at 12:50 UTC||Need Help??|
abithajames has asked for the
wisdom of the Perl Monks concerning the following question:
There should be a variable declared in one file say $error in "file1.pl".
I need to change the value of the variable $error in another file say "file2.pl".
This change should get reflected in "file1.pl".
How can I achieve this?
for eg: file1.pl
$error = 10; #Assigning value 10 to $error.
print "before $error \n"; # This will print 10.
print "after $error \n"; # This should print 20. How can I acheive this?
$error = 20;
You valuable suggestions will be of great help. Basically I want the value of a variable to be changed in a file and the changed value should get reflected in the file from which the former file is executed.