The portable way:
use File::Spec (); my $path = 'c:/Programfile/Perl/test/temp.txt'; my ($volume, $directories, $file) = File::Spec->splitpath($path); my $dir = File::Spec->catpath($volume, $directories, ''); # Optional: $dir = File::Spec->canonpath($dir); print("$dir\n");
Update: Fixed typo in var name.
In reply to Re: How to get the Directory Path
by ikegami
in thread How to get the Directory Path
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |