in reply to Creating a script to pass dir name, basename and just *.pdf & *.tif files

Welcome to PerlMonks.

Please see [id://Writeup Formatting Tips] to learn how to use the nifty code tags. It's good that you have warnings on, but you should also be using strict. You should also not be using local variables in your subroutine, but lexical (or my) variables. See Coping with Scoping.

To get the basenames of files, you can use the CPAN module File::Basename. Since you appear to want to do a recursive traversal of a directory tree, I reccomend using a module like File::Find or File::Finder instead of rolling your own. You can also get a list of files that match a pattern with glob or by doing a regex match while you loop over the filenames.

  • Comment on Re: Creating a script to pass dir name, basename and just *.pdf & *.tif files