in reply to Grep reutrn the occurance of a pattern
#!/usr/bin/perl use strict; use warnings; my @items = qw/yes no no no yes yes no no/; my $number_of_matches = grep(/yes/,@items); print "$number_of_matches\n";
Prints 3.
Update: Noticed that I left out @items, and I see I am not alone in my confusion about exactly what it was the OP wanted.
|
|---|