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.
system("file2.pl");
print "after $error \n"; # This should print 20. How can I acheive this?
file2.pl
$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.
Thanks,
Abitha.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Global Variable
by Corion (Patriarch) on Sep 22, 2008 at 12:52 UTC | |
Re: Global Variable
by lamp (Chaplain) on Sep 22, 2008 at 14:39 UTC | |
Re: Global Variable
by oko1 (Deacon) on Sep 22, 2008 at 14:46 UTC |
Back to
Seekers of Perl Wisdom