# Reading from a filehandle my @wanted; foreach my $line ( <$input_fh> ) { push $line, @wanted if $line =~ /^SELECT poid/; }