use Text::ParseWords; ; while () { chomp; my @words = shellwords($_); print "ID: $words[0]\tCourse: $words[1]\n"; } __END__ "ID" "Course" 9414 "Nutitional Epidemiology" 9414 "Nutritional assessment" 9414 "Undernutrition in the United States" 1371 "Health Politics and Policy" 1371 "Advanced Health Politics?" 1371 "Introduction to Health Policy & Management"