foreach my $line(@query_output) { my ($comp_id,$comp_info)=split(/\s+/,<$line>); print "$comp_id\t$comp_info\n"; }