programming-examples/perl/File/Extracts base file name from full path. Uses DOS-Windows conventions.pl

21 lines
507 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#use File::Basename;
#fileparse_set_fstype("MSDOS");
#The other supported types are AmigaOS, os2, MSWin32, VMS, MacOS, and RISCOS.
#UNIX is the default type.
#!/usr/bin/perl -w
use File::Basename;
fileparse_set_fstype("MSDOS");
$fullname = 'C:\Perl\lib\site\validate.pl';
@suffixlist = '.pl';
($basename, $directory_path, $suffix) = fileparse($fullname, @suffixlist);
print "For $fullname\n";
print "base: $basename\n";
print "path: $directory_path\n";
print "ext.: $suffix\n";