my @j1 = ($a, $b, $c, $d, $e); my @j2 = qw(a b c d e); my $re = grep { $j1[$_] ne $j2[$_] } (0..$#j1); print $re ? "failure\n" : "success\n" ;