Not quite there. Then you have to join $vol and $path together, and File::Spec doesn't provide the means to do that. You might say "But catpath!", but using catpath without a file name is undocumented, and it leaves an errant trailing slash on my system. Rather than using the fragile
use File::Spec::Functions qw( splitpath catpath rel2abs canonpath ); my ($v, $p, $file_name) = splitpath(rel2abs($file_path)); my $dir_path = canonpath(catpath($v, $p));
use the module designed for the task at hand, File::Basename.
use File::Basename qw( fileparse ); use File::Spec::Functions qw( rel2abs ); my ($file_name, $dir_path) = fileparse(rel2abs($file_path));
In reply to Re^2: Dissecting a complete pathname to a file
by ikegami
in thread Dissecting a complete pathname to a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |