#!/usr/bin/perl -w use strict; my (@f) = qw|a ab abc abcd|; if (grep {/Zabc/} @f){ print 'YES!'; } 1;