#!/usr/bin/env perl use strict; use warnings; my @cases = qw/ABA SCO ACC PHC GHF/; my $re = join '|', @cases; for my $text ('SCO', 'Microsoft') { print "$text found (grep)\n" if grep {$text eq $_} @cases; print "$text found (regex)\n" if $text =~ /^$re$/; }