open (FH, "foo.txt"); my @words; foreach () { push @words, split; } close FH; print "@words\n";