in reply to How do i do a direct comparison of an array of strings?
Updates:>perl -wMstrict -le "my ($x, $y) = qw{abXcdYef pqXrsYtu}; my $diff = $x ^ $y; $diff =~ tr{\x00-\xff}{=!}; print $diff; print 'number of differences: ', $diff =~ tr{!}{!}; my @i_diffs = do { my $i = 0; map $_->[1], grep $_->[0] eq '!', map [ $_, $i++ ], split '', $diff; }; print qq{differing positions: @i_diffs}; " !!=!!=!! number of differences: 6 differing positions: 0 1 3 4 6 7
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do i do a direct comparison of an array of strings?
by AnomalousMonk (Archbishop) on Feb 19, 2009 at 20:27 UTC | |
by gone2015 (Deacon) on Feb 20, 2009 at 01:13 UTC | |
by AnomalousMonk (Archbishop) on Feb 20, 2009 at 11:36 UTC | |
|
Re^2: How do i do a direct comparison of an array of strings?
by AnomalousMonk (Archbishop) on Feb 20, 2009 at 01:47 UTC |