in reply to Regex to match last n characters of a string

If you enable warnings you'll see

Nested quantifiers in regex; marked by <-- HERE in m/(.*{ <-- HERE 41} +)$/ a

Which tells you that your regex should be

/(.{41})$/

Note the absence of '*'.

Alternatively, you could also use

$last_41 = substr $buffer, -41;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.