in reply to Figuring out the environment

The syntax of that statement is fine and it should do what you want. That suggests that OUTFILE is not open to write. Have you tested this on the command line?

Without a shebang line, the batch script must be calling this as '/usr/bin/perl [flags] LIST'. Add -w to the flags and lead off your scripts with use strict;. That will get you error messages. $^W can be set if you can't get warnings enabled in the batch script.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Figuring out the environment
by Willman023 (Scribe) on Sep 25, 2002 at 15:59 UTC
    Ok correction, I was able to get a list of environment variables, there's a copy lag from one server to the main webserver so unaware of this I thought it didn't work. However the list of variables does not contain one for current directory or PWD.

    $cwd = $ENV{'PWD'};

    I tried this code with no luck, this time I made sure the page updated :) But more importantly why wouldn't I have this environment variable, and is there another way to get the current directory?

      Do you know what OS the server is running? AFAIK, Microsoft OS's don't have an environment variable for the current directory. However, the Cwd module, which is one of the Perl core modules, provides a function called cwd which returns the current working directory.
      use Cwd; $cwd = cwd(); print "My directory is $cwd\n";

      kelan


      Yak it up with Fullscreen ChatBox

        Thanks alot kelan! I wasn't including the Cwd module (use Cwd;) I now just need to change the directory to another server's folder (probably a chdir will do it), so that helped tremendously!
      IMO, CWD is the most portable solution for finding the current working directory.