Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Answer: How do I find what dir the perl script is running from?

by Theodorus (Initiate)
on Dec 29, 2000 at 20:31 UTC ( #48830=categorized answer: print w/replies, xml ) Need Help??

Q&A > GUI Programming > How do I find what directory the perl script is running from? - Answer contributed by Theodorus

I use:

use FindBin qw($Bin);

$Bin is set to the value of the script's path.

Replies are listed 'Best First'.
Re: Answer: How do I find what dir the perl script is running from?
by Anonymous Monk on Dec 30, 2000 at 00:29 UTC
    Even better (for Unix), you can try one of the following...

    $var = `/usr/bin/pwd`; # put the current dir in to $var

    print `/usr/bin/pwd`; # print the cwd to STDOUT

      this way you'll get dir the script is running _on_, and not the path script is running _from_
Log In?

What's my password?
Create A New User
[Corion]: Likely the date of the release of the module
[Corion]: Yep, seems like that
[Perl300]: ok, thank you Corion
[Perl300]: I was researching few modules and was not sure about what that date indicates

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-12-11 18:05 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (310 votes). Check out past polls.