in reply to Re: parsing HTML
in thread parsing HTML

On a trivial note about counting occurances of letters you can do it all of these ways:

my $txt = "1,2,3,4,5,6"; my $n1 = scalar(split(/,/,$txt))-1; my $n2 = scalar(@{[ split(/,/,$txt) ]})-1; my $n3 = scalar($#{[ split(/,/,$txt) ]})-1; my $n4 = (y/,/,/); my $n5 = (m/,/g);

But the last is by far the fastest because it doesn't do any string modification. It's also the best for golf.

my @a=qw(random brilliant braindead); print $a[rand(@a)];