while () { $first = substr $_, 0, index $_, " "; print "$first\n"; }