while() { chomp; my @array=split(/\s/); # or /\s+/ if you want to collapse whitespace ... }