for my $line (@lines) { my @tmp=split ' ', $line; push @words, $tmp[0]; }