in reply to Testing if a .txt file contains any data
#!perl use warnings; use strict; my $wordlist = 'wordlist.txt'; open (LIST, $wordlist) or die "\n Cannot open $wordlist: $!\n"; my @listofwords; while (<LIST>) { chomp; push @listofwords, $_; } print "There are " . scalar(@listofwords) . " words in $wordlist\n";
|
|---|