I am a big fan of Path::Tiny. I recommend it. It helps file handling at multiple levels.
use 5.10.0; use strictures; use Path::Tiny; my $dir = path( shift || "./" ); $dir->is_dir or die "$dir is not a directory!\n"; for my $file ( grep -f, $dir->children ) { say $file->absolute; say " -> ", $file->basename; }
Update: made the code more generic to either take a dir or use the current dir and report on properness of argument and only list child files.
In reply to Re: Extract main name of file
by Your Mother
in thread Extract main name of file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |