http://www.perlmonks.org?node_id=713006

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.