>perl -wMstrict -le "use List::MoreUtils qw(any); ;; my $s = 'B a B b B c B d'; ;; my @text = split /\s+/, $s; ;; if (any { $text[0] eq $text[ $_ ] } 2, 4, 6, 7) { print 'something was eq'; } " something was eq