You could make it a little more portable by allowing / as well with:
my $str = 'c:\dir\subdir/filename.ext'; my $filename = ( split /\\|\//, $str )[-1];
but then of course you have a regex in there, oh well.
tachyon
In reply to Re: Extracting file name from path
by tachyon
in thread Extracting file name from path
by HTTP-404
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |