# does this look like a S1, S2, or S3 record? These are the only ones that # carry an actual data payload. Other record types do not, so just ignore # them. return unless $line =~ m/^s([1-3])(\p{IsXDigit}{2})(\p{IsXDigit}{4,6,8})(\p{IsXDigit}+)(\p{IsXDigit}{2})$/; my ($type, $count, $address, $data, $cs) = ($1, $2, $3, $4, $5); # does the address length match the record type? return unless length $address == 2 * ($type + 1); # Make sure the COUNT field makes sense. It should represent the sum of # address, data, and checksum fields, in bytes return unless hex($count) == (length($address) + length($data) + length($cs)) / 2;