in reply to Re: Exact string matching
in thread Exact string matching
Dear Monk, I'm so sorry for being very immature, this is my first time posting a question, so plz forgive my immaturity
open(HD,"file") or die ("Cant open"); $text=<HD>; $text=~s/ //g; chomp $text; $pattern="word"; $offset = 0; $pos=index $text,$pattern,$offset; while ($pos != -1) { print "Found $pattern at $pos\n"; $offset = $pos + 1; $pos = index($text, $pattern, $offset); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Exact string matching
by ramprasad27 (Sexton) on Oct 16, 2011 at 11:41 UTC | |
by Anonymous Monk on Oct 16, 2011 at 12:40 UTC |