in reply to How to get the Directory Path

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.

Replies are listed 'Best First'.
Re^2: How to get the Directory Path
by perl_99_monk (Novice) on Sep 23, 2005 at 16:39 UTC
    Thanks a lot... It worked..