Hi all,
Here is a quick one that confuses me. I am trying to open one file in the
cgi-bin directory, modify it's contents, then write the altered file to a
completely different directory (up one directory, then into another
directory). Here is the script:
----------------------------
sub createpage {
open (GETFILE, "<$pathtotemplatepage") ||die " $!"; # open .html template
@contents=<GETFILE>; # read contents into array
$linenum=0;
close (GETFILE);
$lastline=$#contents;
for ($last=0; $last<$lastline+1; $last=$last+1) {
$contents[$last]=~s/:username:/$username/; #change contents
}
open (WRITEPAGE, ">../clients/client1.html"); # write file to new directory
print WRITEPAGE @contents;
close (WRITEPAGE);
}
----------------------------
Here is what I get. The original file (the .html template) is read fine,
altered fine, and written fine, except for two things which I think are
connected. The final file that is written, is written to the cgi-bin
directory (where the script is run), not the "clients" directory AND, the
name of the file is not "client1.html", but rather "../clients/client1.html"
What am I missing? Any help would be appreciated.
Mark