srand( 711 ); . . . sub case2 { my $s1 = 'a' x 39 . 'b'; my $s2 = 'a' x 39 . chr( 98 + rand(4)); my ( $cmp, $loc ) = Cmp_and_Loc ( $s1, $s2 ); } sub Cmp_and_Loc { my ( $s1, $s2, undef ) = @_; my $t = 0; my $cmp = $s1 cmp $s2; if ( $cmp ) { $t = $s1 ^ $s2; $t =~ /^\0*)/; $t = $+[0]; } return ( $cmp, $t ); }