On Tue, Apr 20, 2004 at 09:59:46PM -0400, Bernie Cosell <[EMAIL PROTECTED]> wrote:
> On 20 Apr 2004 at 20:48, Craig S. Cottingham wrote:
> > I couldn't get that to work.
> 
> Really?  I cleaned it up a bit and it seems to work fine:
> 
> sub diff
> {   my $diff = $_[0] ^ $_[1];
>     my ($len) = $diff =~ /^([\0]*)[^\0]/ ;
>     return undef if not defined $len ;
>     return length $len;
> }

Perhaps he used numbers instead of strings.  It's a good idea to always
force the bitops to behave in the mode you want:
   my $diff = "$_[0]" ^ "$_[1]";

Reply via email to