in reply to Re^2: Seeking with 'x' in unpack and out of bounds readsin thread Seeking with 'x' in unpack and out of bounds reads
$str =~ s/^((?:...)+).{0,2}$/$1/; [download]
UPDATE: Corrected typo noticed by kcott.