in reply to pattern matching question

You probably want to use the standard module File::Basename (see its perldoc for details).

Phil

Update: Removed link to CPAN, it's a standard module.