in reply to reg-ex frustration

Long story short, the use of local() makes $i become affected by backtracking. When the regex engine has to backtrack (since .* matched all of "lothlorien", and has to back up 6 characters), the modifications to $i are alos rolled back.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;