my %dict ; my $dict = "d:/perl/words.short" ; open (my $wds, "<", $dict) or die("Can't open wordlist: $!\n") ; my $words = 0 ; foreach my $wd (<$wds>) { $dict{$wd} = 1 ; } say scalar keys(%dict) ; say "got apple" if exists $dict{apple} ; #### D:\Perl>dictest.pl 66384 D:\Perl>