in reply to Get last occurence of a character in a string
Please disregard. I misread the OPs question. This code does the opposite.
my $file = 'c:\folder1\filename.doc'; $file =~ s{ # Substitue... \\ # a backslash [^\\]* # zero or more not-backslashes $ # at the end of string } {}x; # with nothing # allow comments & spaces in search-pattern print $file; # c:\folder1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get last occurence of a character in a string
by pjotrik (Friar) on Aug 06, 2008 at 13:16 UTC | |
by FunkyMonk (Bishop) on Aug 06, 2008 at 13:23 UTC |