http://www.perlmonks.org?node_id=88293


in reply to Extracting file name from path

As bikeNomad said, you are missing a backslash before the w for matching the extension. The following should work:
/.*\\(\w+\.\w{3})/;
Also take a look at File::Basename and File::Spec, which have different methods for splitting and massaging paths and filenames.

--ZZamboni