I have a file of the following structure
In myParser.pl:
In mFileParser.pl
The problem is in processMFile within the mFileParser.pl, when it is invoked via myParser.pl, the variable at
within
is not set to "root";
What have I done wrong? I would rather not have to initialise common/global variable across two scripts anywhere and everywhere
! Where should it really be initialised?
Note, there is no subroutine defined in the parent- myParser.pl
In myParser.pl:
Code:
use File::Spec;
require 'mFileParser.pl';
$tempDir = File::Spec->catfile("root","temp");
#Some other codes
processMFile(); #defined in mFileParser.pl
#Some other codes
In mFileParser.pl
Code:
use File::Spec;
sub processMFile()
{
#someCode
print "DEBUG TEMPDIR-" . $tempDir ."\n";
$tmpFile = File::Spec->catfile($tempDir,"tmp.txt");
#someCode
}
Code:
$tempDir
Code:
print "DEBUG TEMPDIR-" . $tempDir ."\n"
What have I done wrong? I would rather not have to initialise common/global variable across two scripts anywhere and everywhere
Note, there is no subroutine defined in the parent- myParser.pl