in reply to Re^2: Seeking with 'x' in unpack and out of bounds reads
in thread Seeking with 'x' in unpack and out of bounds reads

Another approach is to preprocess your string with a regex to remove the troublesome byte(s).
$str =~ s/^((?:...)+).{0,2}$/$1/;

UPDATE: Corrected typo noticed by kcott.

Bill