i know, my past 2 perl help threads were tards, but this one is for real i swear...
here is the code:
#!/usr/local/bin/perl
# assign date/time to variables
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
print "Content-type: text/html\n\n";
$filename = "$mon.dat";
$path = "/dw08/d20/mssug/cgi-bin/test";
print <<EOF;
<HTML>
<HEAD><TITLE>Hello, world!</TITLE></HEAD>
<BODY><H1>
EOF
open (OUTFILE, ">$path/$filename");
if (-e $path/$filename){
print <<EOF;
Hello, world!
EOF
}
else {
print <<EOF;
$path/$filename does not exist!
EOF
}
print <<EOF;
</H1></BODY>
</HTML>
EOF
the problem is this, for whatever reason, the conditional i have for the if statment is not working. the file exists, but the script still goes to else, and prints "so and so does not exist!"
it works fine if i just use $filename instead of $path/$filename, but why? shoudln't the latter work as well?
here is the code:
#!/usr/local/bin/perl
# assign date/time to variables
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
print "Content-type: text/html\n\n";
$filename = "$mon.dat";
$path = "/dw08/d20/mssug/cgi-bin/test";
print <<EOF;
<HTML>
<HEAD><TITLE>Hello, world!</TITLE></HEAD>
<BODY><H1>
EOF
open (OUTFILE, ">$path/$filename");
if (-e $path/$filename){
print <<EOF;
Hello, world!
EOF
}
else {
print <<EOF;
$path/$filename does not exist!
EOF
}
print <<EOF;
</H1></BODY>
</HTML>
EOF
the problem is this, for whatever reason, the conditional i have for the if statment is not working. the file exists, but the script still goes to else, and prints "so and so does not exist!"
it works fine if i just use $filename instead of $path/$filename, but why? shoudln't the latter work as well?
