in reply to •Re: Directory in which your program is running...
in thread Directory in which your program is running...

Oops. I should have specified: the directory in which the program is located; which should be the same as the directory of the process since I'm not using any chdir calls.

Thanks,

Jon

Update: further clarification per Merlyn's advice below: I will only be running the scripts from the directory they are in.

Replies are listed 'Best First'.
•Re: Re: •Re: Directory in which your program is running...
by merlyn (Sage) on Jan 26, 2003 at 18:34 UTC
    Oops. I should have specified: the directory in which the program is located; which should be the same as the directory of the process since I'm not using any chdir calls.
    No, that's precisely the thinking that will get you into trouble, which is why I asked the question I did.

    When I invoke "some/path/to/script", my current directory hasn't changed, but the script is located in some other directory. So I wanted to know which of the two you wanted: the current directory, or the directory of the script.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re: Re: •Re: Directory in which your program is running...
by virtualsue (Vicar) on Jan 26, 2003 at 20:46 UTC
    Another way to do it:
    use File::Basename; my $dir = dirname $0;
    Or, if you are *sure* that you will only be running the scripts from the directory that they are in, you can specify relative paths starting from ".".

      Thanks - I eventually did use relative paths. I am sure to only be running the scripts from the directory in which they reside. I'm a team of 1, just with a couple/three machines I flop back and forth on. : )

      Jon