#!/usr/bin/env perl use strict; use warnings; use Data::Printer; my @pcov = qw( junk yphs.pc0.samelogic.fois_ebs.sbetrgt_inst nothing ); my @realassert = qw( stuff sbetrgt_inst other); my @thelist; foreach my $regex ( @realassert ) { push @thelist, grep{ /$regex/ } @pcov; } p @thelist;