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

You have an error in the regex; too many quantifiers - drop the asterisk, ($last_41) = $buffer =~ /(.{41})$/; You could also do this with substr, $last_41 = substr $buffer, -41;

After Compline,
Zaxo