my %offset = (); # inserts $offset{$key} += 1; # length of insert # deletes $offset{$key} -= 1;