use strict; use warnings; my @array1 = ( q{ the_form_below}, q{this_job}, q{complete}, q{ and_press}, ); my @array2 = ( q{and_press}, q{ online_Please}, q{the_form_below }, q{submit_will_only}, ); for my $idx1 ( 0 .. $#array1 ) { for my $idx2 ( 0 .. $#array2 ) { if( cleanUp( $array1[ $idx1 ] ) eq cleanUp( $array2[ $idx2 ] ) ) { print qq{\$array1[ $idx1 ]: >$array1[ $idx1 ]<\n}, qq{Equivalent to\n}, qq{\$array2[ $idx2 ]: >$array2[ $idx2 ]<\n}, q{=} x 40, qq{\n}; } } } sub cleanUp { my $str = shift; $str =~ s{^\s+}{}; $str =~ s{\s+$}{}; return $str; }