QM has asked for the wisdom of the Perl Monks concerning the following question:

I need to determine the absolute path of a directory in a variable, such as in $0. I'm already using fileparse, but sometimes it returns a relative path for the directory. I vaguely recall some module or trick to get the absolute one, but can't remember enough to find it.

Can someone help me?

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re: Where Am I: Finding absolute path
by jwkrahn (Abbot) on Aug 19, 2006 at 01:25 UTC
Re: Where Am I: Finding absolute path
by swampyankee (Parson) on Aug 19, 2006 at 02:10 UTC

    I'd use Cwd and its getcwd to get the absolute path of the current directory; given this and the relative path to the file getting the file's complete path is straightforward.

    emc

    Experience is a hard teacher because she gives the test first, the lesson afterwards.

    Vernon Sanders Law
Re: Where Am I: Finding absolute path
by mickeyn (Priest) on Aug 19, 2006 at 05:50 UTC
    use FindBin qw($Bin);
    $Bin is what your path ...

    Enjoy,
    Mickey