#!usr/bin/perl -w use strict; open FILE, '<', "input.txt" or die "unable to open input.txt"; # the $! variable adds the O/S specific info, but it is not # not always that useful. my @all_words; while () { my @these_words = split(' ', $_); foreach my $this_word (@these_words) { push @all_words, $this_word; } }