Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by Theodorus (Initiate)
on Dec 29, 2000 at 20:31 UTC ( [id://48830]=note: print w/replies, xml ) Need Help??


in reply to How do I find what directory the perl script is running from?

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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://48830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-24 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found