Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: How to get a file's full path?

by athomason (Curate)
on Aug 13, 2005 at 21:52 UTC ( #483614=note: print w/replies, xml ) Need Help??

in reply to How to get a file's full path?

Try File::Spec, namely its rel2abs() function:
$abs_path = File::Spec->rel2abs( $path ) ; $abs_path = File::Spec->rel2abs( $path, $base ) ;
It's a builtin module (at least in 5.8.7) so installation shouldn't be a concern.

See also the extended discussion at Absolute pathnames from relative?.

Replies are listed 'Best First'.
Re^2: How to get a file's full path?
by bart (Canon) on Aug 14, 2005 at 11:17 UTC
    Try File::Spec, namely its rel2abs() function:
    It's not a function, it's a class method. If you want a function — and I can understand that, try File::Spec::Functions (also standard) instead.
    use File::Spec::Functions qw(rel2abs); $abs_path = rel2abs( $path );

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://483614]
[marto]: good morning all
[Corion]: Hi marto!
[Corion]: I hope you're well!
[Discipulus]: good morning monks!
[marto]: Corion, I've been better, but things are improving in many cases :) Simply not enough time/rest :)
[Corion]: Hi Discipulus!
[marto]: hopefully you guys are also well :)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2017-07-27 07:33 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (404 votes). Check out past polls.