Arrays and slices are interpolated into double-quoted strings by joining the elements with the delimiter specified in the $" variable($LIST_SEPARATOR if "use English;" is specified), space by default. #### my @results = grep( /@matches/, @netstat ); #### my @results = grep(/invalid headers packets dropped/, @netstat); #### foreach my $match (@matches) { my @results = grep /$match/, @results; print @results; }