in reply to Mostly Harmless

And now using the Set::Scalar module.
use Modern::Perl; use Set::Scalar; my $first_word = 'CHARLIE ROOT'; my $second_word = 'HARRY NODE'; my $first = Set::Scalar->new( split //, $first_word ); my $second = Set::Scalar->new( split //, $second_word ); say $first - $second; # difference between $first and $second say $second - $first; # difference between $second and $first say $first % $second; # symmetric difference
Output:
(C I L T) (D N Y) (C D I L N T Y)

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics