foreach my $element (@one) { if ($element =~ m/^vlan \d*,\d*/g) { print"$element"; } }