Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

( #47267=categorized answer: print w/ replies, xml ) Need Help??

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

I picked up this cross-platform directory checker somewhere... Works on both NT and *NIX
if ($0=~m#^(.*)\\#) { $cgi_dir = "$1"; } elsif ($0=~m#^(.*)/# ) { $ cgi_dir = "$1"; } else {`pwd` =~ /(.*)/; $ cgi_dir = "$1"; }

Comment on Answer: How do I find what dir the perl script is running from?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2014-12-18 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (68 votes), past polls