my @grepnames = grep {/"ER"/} @test2; #### my @grepnames; for my $test2item (@test2) { push @grepnames,$test2item if $test2item =~ /"ER"/; }