in reply to problem related to project key counter
i do not where to startStart with the free online documentation. From perlfaq4, How can I count the number of occurrences of a substring within a string?.
Adapting the FAQ example to vowels:
use strict; use warnings; while (<DATA>) { chomp; my $str = $_; my $count = ($_ =~ tr/aeiouAEIOU//); print "$str: $count\n"; } __DATA__ Here I am. djghsjkghk It's me.
prints:
Here I am.: 4 djghsjkghk: 0 It's me.: 2
|
|---|