Generalized overlap.pl