|
|
| more useful options | |
| PerlMonks |
Re: how to remove everything before last slash in perl?by 7stud (Deacon) |
| on Jun 23, 2012 at 21:32 UTC ( #978016=note: print w/ replies, xml ) | Need Help?? |
|
Your regex: $output =~ s{.*(/)}{$1}...says to match any number of characters followed by a slash, then replace the whole match with a slash. As a result, if there is a match there is going to be a slash in the output. There's actually no point in even specifying $1 because your substitution is the same as:
Here are some other solutions: 1.
2.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||