Hi All,
I'm new here so apologies if there's something not quite done right in my first post on here.
I'm fairly new to Perl but this is the first bit I've tried to write at home on my own.
I want to have a .pl file that runs in a browser window by passing html to it then opens a .txt file and reads it's contents into a variable, that I can use else where. I started by getting it to do this but with local files on my laptop which was pretty straightforward.
The problem at the moment is that it says it can't open the file, I'm assuming because I'm not calling it properly as I have ftp access to the files, it's chmod is correct and the path and file name is correct.
Here's the code I've worked out so far by reading up tutorials on the net...
#!/usr/bin/perl
use strict;
use warnings;
print "Content-type: text/html\n\n"; # must send a header first
print "<html>";
print " <head>";
print " A box with some text in it...\n<br>";
print " </head>";
print " <body>";
if ( $^O eq "MSWin32") { system "dir" or warn "Couldn't run dir $!\n" }
else { print "Not a Windows machine.\n" }
my $INPUT_FILEHANDLE = "input_filehandle"; # open a handle to input text to
my $OUTPUT_FILEHANDLE = "output_filehandle"; # open a handle to output text to
my $INPUT_FILE_NAME = 'd:\domains\jacamar.co.uk\wwwroot\cgi-bin\Text_box_content.txt';
open (INPUT_FILEHANDLE, "<$INPUT_FILE_NAME") or die "<br>Can't open $INPUT_FILE_NAME for reading \"$!\"\n"; # open input file
etc
What it shows is:-
A box with some text in it...
Can't spawn "cmd.exe": No such file or directory at d:\domains\jacamar.co.uk\wwwroot\cgi-bin\page_editor.pl line 15. Can't open d:\domains\jacamar.co.uk\wwwroot\cgi-bin\Text_box_content.txt for reading
I know it can't find cmd.exe as the people who host the server say it's not compatible or something... so why on earth can't if find this Text_box_content.txt???
many thanks in advance for any replies
Sarah