in reply to how to remove everything before last slash in perl?

mipatel:

It sounds like File::Basename might be a good fit for you. But if you *really* want to use a regex, you could do something like s#^.*/##.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: how to remove everything before last slash in perl?
by mipatel (Novice) on Jun 23, 2012 at 19:56 UTC
    hey thanks for your answer. It worked. now i dont even have the last slash :)

      The fact that you began with this…

      s{.*(/)}{$1};

      …and ended up with this…

      s{^.*/}{};

      …makes me suspicious that you both started and ended by using someone else's regular expression pattern, and that you understand neither one.

      My advice: Avoid copy and paste programming. Sometimes, it's better to figure out how to do something yourself than it is to ask someone else how to do it. You learn more this way.