I have a configuration file which contains many 'name = value' statements. This configuration file is used by several related cgi scripts.
I seem to be having an issue with a few lines in my config file being read into my perl script and then being written to by a system command. The file is appended with a '?' at the end. So if i have these statements:
entrylist = /home/testuser/tempfile = /tmp/entrylist
$tempfile is written to (empty file) as /tmp/entrylist?
Has anyone seen this before? The operating system is redhat linux if that matters.
here is the code that reads in the config file:
if i uncomment the $entrylist and $tempfile statements in the above code, everything works fine. I've checked and rechecked permissions too. Any help would be appreciated.
thanks,
jim
I seem to be having an issue with a few lines in my config file being read into my perl script and then being written to by a system command. The file is appended with a '?' at the end. So if i have these statements:
entrylist = /home/testuser/tempfile = /tmp/entrylist
$tempfile is written to (empty file) as /tmp/entrylist?
Has anyone seen this before? The operating system is redhat linux if that matters.
here is the code that reads in the config file:
Code:
#! /bin/perl -wT
$config_file = "./AUTO.cfg";
print header;
open ( CONFIG_FILE, "< $config_file" ) ;
while ( ) {
chomp;
next if ( /^#/ );
if ( /^\s*(\S+)\s*\=\s*(.+)\s*$/ ) {
eval( "\$$1 \= \"$2\"" );
$DEBUG && printf( "%-25s = %s\n", $1, $2 );
}
}
close( CONFIG_FILE );
###$entrylist = "/home/testuser/[URL unfurl="true"]www/cgi-bin/DIR1/Sept2005";[/URL]
###$tempfile = "/tmp/entrylist";
open(LIST, ">>$entrylist") or die "Entry List ($entrylist) is not available at this time";
print LIST "$FirstName,$LastName,$Number,$CarClass$Group,$CarMakeandModel,$SponsorTeam,$Website,$Email\n";
close(LIST);
system " sort -t, -nu -k 3,3 $entrylist > $tempfile ";
system " mv $tempfile $entrylist ";
if i uncomment the $entrylist and $tempfile statements in the above code, everything works fine. I've checked and rechecked permissions too. Any help would be appreciated.
thanks,
jim