Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Directories Help

by themage (Friar)
on Aug 25, 2008 at 14:37 UTC ( #706696=note: print w/replies, xml ) Need Help??

in reply to Directories Help

Hi smunro16,

I presume that your question is on how to get the path to the scripts.

You have two ways to get it. The first is using $0, that will give you the path to the current perl script, se second is using use Find::Bin.

If you choose to use $0:
my $path=$0; $path=~s/[^/]+$//;

$path will now have the path to the directory where your perl script is.

Note, however, that if you chdir inside you perl script $0 may not be a valid path to you perl script, once it may be relative to you initial path.

To know more about this you may want to read the thread How do I get the full path to the script executing?.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://706696]
beech testing in the sidebar
beech *me* me *me
beech *me* ... test
[beech]: ...
beech me *me* ... test me *me* test
[beech]: me

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2017-03-28 23:39 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (343 votes). Check out past polls.