in reply to Extract main name of file

Hello,

Also core module File::Spec and notably the splitpath function can be useful

($volume,$directories,$file) = File::Spec->splitpath( $path );

Then you need to manage the extension of the file with a regex or as you have done already.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.