in reply to Re: Getting the filename from full path name ?
in thread Getting the filename from full path name ?

Your second solution matches the first / in the path. As Chris stated above you probably would rather do:

my ($file) = $a =~ m|/([^/]+)$|;

satchm0h

Replies are listed 'Best First'.
Re: Re: Re: Getting the filename from full path name ?
by etcshadow (Priest) on Apr 15, 2004 at 17:53 UTC
    Yes, sorry. I made the classic mistake of assuming that non-greedy matching was, in fact, non-greedy. In general, I avoid the use of non-greedy matching (instead, being explicit about what I don't want the match to bleed into) for this basic reason. I was just being sloppy.
    ------------ :Wq Not an editor command: Wq