in reply to RE: Counting occurances
in thread Counting occurances

Don't use a regex if you don't really want a regex, which you don't, because you now found all the items that contain "a", not just be equal to them. You probably wanted this instead:
print "a occurs ".grep($_ eq "a", @list)," times\n";

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: RE: Counting occurances
by dempa (Friar) on Jul 13, 2000 at 19:23 UTC
    OK, my point was to show that grep returned the number of occurances in scalar context, but ofcourse you're right. Point taken.