$value =~ s{(^|[^\xff])(\xff*)$}{ chr(ord($1) + 1) . ("\x00" x length($2)) }e;