in reply to Re: If there a way to find the location of the first difference between two strings?
in thread If there a way to find the location of the first difference between two strings?
use 5.010; my $t = $s1 ^ $s2; my ($f) = $t =~ /^(\x{00}*)/; say length $f;
Another way to do that:
use 5.010; my $t = $s1 ^ $s2; $t =~ /^\0*/ && say $+[0]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: If there a way to find the location of the first difference between two strings?
by flexvault (Monsignor) on Mar 26, 2012 at 10:36 UTC |