use strict; use warnings; my $word = "alighthousa"; my $found; if (($found = ( keys %{{map { $_ => 1 } ($word =~ m/([aeiou])/g) }} )) == 5) { print "Found all 5 vowels\n"; } else { print "Found only $found vowels\n"; } #### ($word =~ m/([aeiou])/g) # returns a list of all vowels found in $word map { $_ => 1 } ($word =~ m/([aeiou])/g) # builds a list for initializing a hash { map { $_ => 1 } ($word =~ m/([aeiou])/g) } # a reference to an anonymous hash initialized with the list keys %{ { map { $_ => 1 } ($word =~ m/([aeiou])/g) } } # return keys of the dereferenced anonymous hash # the keys in a hash are unique, this effectively # eliminates duplicates, and gives a list of unique # vowels found in the string $found = ( keys ... ) # this assigns the number of unique vowels found into $found