Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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

by cei (Monk)
on Dec 19, 2000 at 01:39 UTC ( #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? - Answer 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"; }

Log In?

What's my password?
Create A New User
[stonecolddevin]: Discipulus i don't practice anymore but i studied Pai Lum, it was a mish mash of northern and southern. lots of emphasis on the 5 animals

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2017-11-22 19:12 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (327 votes). Check out past polls.