#!/usr/bin/perl use strict; # https://www.perlmonks.org/?node_id=11155923 use warnings; use feature 'bitwise'; my $str1='LFGSLSIIVAHHM'; my $str2='LFGSLSIIVSHHM'; print +($str1 ^. $str2) =~ tr/\0//, " characters are the same\n";
Outputs:
12 characters are the same
In reply to Re: Compare two strings of same length, character-by-character
by tybalt89
in thread Compare two strings of same length, character-by-character
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |