I'm running perl 5.8.8 on Ubuntu 7.10.
I have a basic perl script, checkdir.pl that checks a directory for files, parses them, then moves them. I get the list of filenames in the directory ok, the problem comes in when I pass the filename to the parser pubroutine, located in a package in another file.
My initial checkdir.pl file includes the following:
[code]
use Parse;
.....
print "Processing file...$file\n"; -> $file is correct at this point....
($return) = Parse::parse_file($file);
....
In File 2, Parse.pm, I have the following:
package Parse;
use vars qw($file, $date);
print "Entering parse\n"; -> ok until here
sub parse_file {
print "file is $file\n"; -> $file is NOT correct here - it is blank
.....
return $file, $date;
}
My output shows the filename is correct in the first file, but is not getting passed to the sub parse_file, in the package Parse. Can anyone see what I am doing wrong??
Start Free Trial