So, a bald 'print' cant be used!To be a competitive golfer you have to be tenacious, devious and challenge assumptions. So I wouldn't rule out using a bald print just yet. At least, not without first trying to find a way to adjust your algorithm so that it can be used.
For example, why do you subtract 3 at the end, as in print$n-3? Is that to compensate for adding 3 when you (always) match at start of string? If so, you could try to eliminate the need to subtract 3 by adjusting your regex to not match at start of string.
In any case, I suggest you study every line of perlre looking for something, anything, that might help you shave a stroke. That is the attitude required to win at golf.
In reply to Re^3: Code Shortening (golf)
by eyepopslikeamosquito
in thread Code Shortening (golf) [RESOLVED]
by Young Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |