Try
sub compare{ return ( length $_[0] == length $_[1] ) && ( length( $_[0] ) - 1 <= ( $_[0] ^ $_[1] ) =~ tr[\0][\0] ) }
In reply to Re: Tell whether two strings differ at only one position
by BrowserUk
in thread Tell whether two strings differ at only one position
by rg0now
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |