in reply to Creating a script to pass dir name, basename and just *.pdf & *.tif files
How Can I remove the PATH and get just the basename? How can I get just *.pdf, if this directory had different files in it? (like *.tif files)1) use File::Basename
2) You have a list of filenames. Just grep those out you want:use File::Basename qw(fileparse); my ($path,$file,$suffix) = fileparse ("filename", "\.[^\.]+$");
@lines = grep { /\.tif$/i } readdir (DIR);
|
|---|