in reply to compare initial
#!/usr/bin/perl # https://perlmonks.org/?node_id=1218306 use strict; use warnings; my $a = 'TTTATTT'; my $b = 'TTTTTTT'; my $c = 'TBTTTTT'; print "compare $a to $b, difference is ", $a =~ s/[$b]+//gr, $b =~ s/[$a]+//gr, "\n"; print "compare $b to $c, difference is ", $b =~ s/[$c]+//gr, $c =~ s/[$b]+//gr, "\n";
Outputs:
compare TTTATTT to TTTTTTT, difference is A compare TTTTTTT to TBTTTTT, difference is B
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compare initial
by locked_user sundialsvc4 (Abbot) on Jul 11, 2018 at 14:54 UTC |