in reply to Extracting filename from a path string

The way which I handled this within CGI::Upload was to make use of File::Basename and HTTP::BrowserDetect. For example:

use File::Basename; use HTTP::BrowserDetect; fileparse_set_fstype( do { my $browser = HTTP::BrowserDetect->new; return 'MSWin32' if $browser->windows; return 'MacOS' if $browser->mac; $^O; } ); my @file = basename($path, '\.[^\.]*');

This code makes use of HTTP::BrowserDetect to determine the browser and thus operating system which has submitted the multipart-encoded request. This is then used to set the file-system parsing routines of File::Basename appropriately - The basename method of this module is then used to strip the directory path and return the submitted file name.