Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: how do I get fullpath for a file

by turnstep (Parson)
on Apr 14, 2000 at 00:48 UTC ( [id://7544]=note: print w/replies, xml ) Need Help??

in reply to How do I get the full path for a file?

Add this to the top of your code:

use Cwd;

Then you can just:

$thisdir = cwd();

This gets the directory the "safest" way. If you are definitely on unix, however, you can simply say:

$thisdir = `pwd`;
which is usually what Cwd does on unix systems. It has a few other options, such as fastcwd() and getcwd() but they are not used much. You can grab the name of the script itself by looking in $0 or even __FILE__.

If you are doing it through the web, check out the environment variable 'SCRIPT_FILENAME'


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-05-27 22:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found