in reply to Dissecting a complete pathname to a file
Path::Class does it all, and does it well.
use Path::Class; my $file = './hello.txt'; my $path = Path::Class::File->new($file)->absolute; print "the file ", $path->basename", "is in the ", $path->dir, "directory\n"; # or if dealing with file specifications of a different platform... $file = "c:\\Documents and Settings\\you\\..\\me\\hello.txt"; $path = Path::Class::File->new_foreign('Win32', $file)->absolute;
It really is the only module you need when dealing with this sort of stuff. No special cases to remember, it just works as it should.
There is also a procedural interface if using objects isn't your thing.
• another intruder with the mooring in the heart of the Perl
|
|---|