#!/usr/bin/perl
use strict;
use warnings;
my @data = qw ( 01 b2 01 00 b6 81 81 01 b4 0a 01 01 01 01 00
01 00 00 01 00 c7 82 82 01 b2 01 00 b8 );
$_ = join(' ', @data);
while ( /(8[[:xdigit:]])\s+\1/g ) {
print "Duplicate $1 found at character " . pos() . "\n";
}
####
bash$ superdoc.pl
Duplicate 81 found at character 20
Duplicate 82 found at character 68
##
##
# while ( /([[:xdigit:]]{2})\s+\1/g ) {
##
##
bash$ superdoc.pl
Duplicate 81 found at position 20
Duplicate 01 found at position 35
Duplicate 01 found at position 41
Duplicate 00 found at position 53
Duplicate 82 found at position 68