local $/ = " "; # two spaces. while (my $rec = <>) { chomp($rec); foreach my $field (split /[ ]/, $rec) { # Any x20 space for field separator, after having dealt with double-spaces. # Do something with $field } }