use Data::Dumper; my @out = grep /FC_DVT/, split("\n", $out); print Dumper( \@out ) . "\n";