in reply to How to run index on this one?
Gives:use strict; use warnings; my $string='YYSFTVMETDPVN[115]HMVGVISVEGRPGLFWFN[115]ISGGDK'; my $offset = 0; my $substring = 'N[115]'; my @positions; while (1) { my $pos = index($string, $substring, $offset); last if $pos < 0; push @positions,$pos; $offset = $pos + length($substring); } print "Positions: @positions\n";
Positions: 12 35
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to run index on this one?
by Anonymous Monk on Nov 25, 2009 at 15:23 UTC | |
by cdarke (Prior) on Nov 25, 2009 at 15:31 UTC |