#!perl -wl my @L1 = qw/A b c de fgh ijk lmno pqrst uvwxyz/; my @L2 = qw/a b c de fgh ijk lmnO pqrsT uvwxyZ/; my @MATCHES = (); my $LMATCH = 0; for $I1 (sort{length($b)<=>length($a)}@L1){ last if length($I1) < $LMATCH; for $I2 (grep{$_ eq $I1}sort{length($b)<=>length($a)}@L2){ $LMATCH = length($I2); push @MATCHES, $I1; } } print "LIST1: " . scalar @L1 . " items LIST2: " . scalar @L2 . " items MATCHES: @MATCHES";
perl -e"map print(chr(hex(( q{6f634070617a6d692e7273650a}=~/../g)[hex]))), (q{375542349abb99098106c}=~/./g)"
In reply to Re: finding longest common substring
by pizza_milkshake
in thread finding longest common substring
by revdiablo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |