$ cat junk BRCA1:breast cancer 1, early onset TNF: tumor necrosis factor OMG:oligodendrocyte myelin glycoprotein $ perl -F: -lane " print $F[0]; " junk BRCA1 TNF OMG $ perl -MO=Deparse -F: -lane " print $F[0]; " junk BEGIN { $/ = "\n"; $\ = "\n"; } LINE: while (defined($_ = )) { chomp $_; our(@F) = split(/:/, $_, 0); print $F[0]; } -e syntax OK