in reply to Re: use File::Basename - need to specify OS?
in thread use File::Basename - need to specify OS?
So if you know the path is a MSDOS path, you should use File::Spec::Win32->splitpath instead of File::Spec->splitpath. See here:
would return c:\foo\bar\basename at ... on a Unix system, whileuse File::Spec; warn ((File::Spec->splitpath("c:\\foo\\bar\\basename"))[-1]);
would return basename at ... on all systems.use File::Spec::Win32; warn ((File::Spec::Win32->splitpath("c:\\foo\\bar\\basename"))[-1]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: use File::Basename - need to specify OS?
by pelagic (Priest) on Apr 21, 2004 at 11:18 UTC |