in reply to Slightly OT: Perl and CGI - reading a file

Does print $ENV{PWD} print anything? If not, you might benefit from using warnings and strict in your script (you should anyway) because they'd warn you that you were trying to use an undefined variable; Try
use Cwd; my $current_dir = cwd;

update: and remember that the current working directory of your script is set by your web server and may not be the same as the physical directory your script is located in and also may not allow you to keep regular files in the same directory as your scripts, see your web server apps. But the Cwd will at least tell you what your working directory is.

Replies are listed 'Best First'.
Re: Re: Slightly OT: Perl and CGI - reading a file
by C_T (Scribe) on Mar 30, 2004 at 23:46 UTC
    My header is as follows:

    #! /usr/bin/perl -w use CGI qw(:standard); use CGI::Carp ('fatalsToBrowser'); #send any errors to the browser use strict;

    I'm not sure if it prints anything. I'll do some tests and get back to you.

    Charles Thomas
    Madison, WI
Re: Re: Slightly OT: Perl and CGI - reading a file
by C_T (Scribe) on Mar 31, 2004 at 00:09 UTC
    update:
    use Cwd; my $current_dir = cwd;

    This gives the same error as the other two methods. You may be on to something with your advice that files may not be allowed in the same directory as the CGI scripts. I wonder if their tech support people would know anything about that...

    Charles Thomas
    Madison, WI