Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my $string = 'perlmeme.org'; my $char = 'e'; my $offset = 0; my $result = index($string, $char, $offset); while ($result != -1) { print "Found $char at $result\n"; $offset = $result + 1; $result = index($string, $char, $offset); }
$string = 'IIIIMMMMMMMOOOOOOOOOOMMMMMMMMMMMMMMMIIIIIIMMMMOOOO';
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: how do you use the index function on this example?
by Anonymous Monk on Sep 21, 2015 at 19:48 UTC | |
by AnomalousMonk (Archbishop) on Sep 21, 2015 at 22:12 UTC |