Probably slower than what you're using, but easier to understand (I hope):
for(my $str = 'vaction.msg'; $str; $str = substr($str, 1, length($str) +)) { $replace_on =~ s/$str//; }
Ahh, the rarely seen (around here, anyway) three-element form of for. I've tested this loop and it produces the strings correctly. I don't know if this exactly matches your needs, but you should be able to modify it easily enough.
Update: Forgot that you need to escape the '.' before it gets put in a regex, which complicates things a bit.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
In reply to Re: more efficient regular expression please
by hardburn
in thread more efficient regular expression please
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |