sub common { if ( $_[0] eq $_[1] ) { return( $_[0], "", "" ); } else { use bytes; my $x = $_[0] ^ $_[1]; $x =~ m!^(\x00*)!; my $pos = length $1; my ( $len0, $len1 ) = ( length($_[0])-$pos, length($_[1])-$pos ); return( unpack("a${pos}", $_[0]), unpack("x${pos}a*", $_[0]), unpack("x${pos}a*", $_[1]), ); } }