Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-06-03 23:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What kind of chocolate gives you the most pleasure?















    Results (141 votes), past polls