in reply to Paths for filenames from Windows with TYPE=file
Personally I would tend to want to throw away the original filename as fast as possible, but I don't know the specifics of your application.
If you want to strip out the path from the canonical name the following will do the trick:
use File::Basename; # it's in the core distribution $canonical =~ tr{\\}{/}; # if the path separator is \ and not / my $filename = basename( $canonical );
Note that you may have to fiddle mapping \ to / to get File::Basename to work correctly on Unix platforms.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Paths for filenames from Windows with TYPE=file
by bwana147 (Pilgrim) on Jun 27, 2001 at 20:03 UTC |