while (my $line = ) { if ( $line =~ /^(\S+)/ ) { print "$1\n"; } }