Three tidbits to add to what's already been said:
The (?{...}) and (??{...}) regexp assertions are closures. They capture the lexical scope that existed when the regexp was compiled. The use of a package variable instead of a lexical variable — BrowserUK's solution — thus avoids the problem.
Your code fails if there are newlines in your input. "." won't match a newline without the s modifier.
Aside from unpack, Digest::CRC provides a number of known checksum algorithms in a tested package. Implemented in C (with a Perl fallback) and dedicated to the task, Digest::CRC and unpack should be much faster than your regexp solution.
In reply to Re: Weird behaviour with match-time code evaluation and backtracking
by ikegami
in thread Weird behaviour with match-time code evaluation and backtracking
by moensch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |