No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
++ matches possessively. This means that it will hold on to what it finds and not backtrack if the match fails with the current amount of matching handled by ++. Contrast this with A+, where it will attempt a match of a maximum amount of As, then if the match fails, an A will be "given up" by A+, and a match will be attempted again with one less A. In the case of a failing match, if ++ will suit your needs, ++ is often many times more efficient (faster at failing when it does fail to match). In some cases, the difference between + and ++ is trivial. In other cases they are not logically equivalent. Such as in:
As a matter of good practice and efficiency, I use ++ wherever possible. I do the same with *+ In reply to Re^2: Polish Prefix Calculator
by protist
|
|