use strict; use warnings; open FH, "file.txt" or die "can't open file : $!"; my $count=0; while() { my @array=split; for (@array) { if (/a/ && /e/ && /i/ && /o/ && /u/) # Checking the vowels by using if statement { # Printing and counting the words print "$_\n"; $count++; } } } print "No of words: $count";