in reply to Re: Re: Re: Re: convert windows path
in thread convert windows path
and you want to getmy $filepath = 'c:\somedir\file.ext'
then$filename eq 'file.ext'
Oughta do it - i.e. capture the longest possible string at the end of the filepath that is either a word character (alpha-num or _) or a dot. Or if you think there might be non-word characters in the file name, $filepath =~ /([^\\|^\/]*)$/; - capture the longest string at the end that doesn't have either a "\" or a "/".$filepath =~ /([\w|\.]*)$/; my $filename = $1;
|
---|