Keep It Simple, Stupid | |
PerlMonks |
Re: extract file name from a dynamic pathby harleypig (Monk) |
on Sep 06, 2008 at 17:34 UTC ( [id://709534]=note: print w/replies, xml ) | Need Help?? |
I would agree with the response above. Use File::Basename. It handles a lot of things you wouldn't necessarily think to include. However, for the sake of completeness, there are a couple of ways you could do this: ( $filename ) = $tst =~ /^.*\\(.*)$/ $filename = ( split /\\/, $tst )[-1]
Harley J Pig
In Section
Seekers of Perl Wisdom
|
|