#!/usr/bin/perl -l use strict; use warnings; use Algorithm::Diff::XS qw(LCS); my(@a) = split (//, q[a c s f 'pl' j k s], 0); my(@b)= split(//, q[m e f z x s f 'pl'], 0); print LCS( \@a,\@b );