What is the fastest way to count the number of times a certain string appears in a bigger one? My best guess would be to replace all instances of that string with nothing, c
You could use a global regex. Something like:
my @matches = $bigstring =~ /($littlestring)/g; my $count = @matches;