Help for this page

Select Code to Download


  1. or download this
    sub compare {
      (($_[0] ^ $_[1]) =~ tr/\0//c) < 2;
    }
    
    print((compare('abc', 'abcd') ? 'ok' : 'not ok'), "\n");
    
  2. or download this
    sub compare {
       length $_[0] ==  length $_[1] && (($_[0] ^ $_[1]) =~ tr/\0//c) < 2;
    }