in reply to Calculations in Regexp
Why not just $flag_count++ if ($data=~/<BEGIN_FLAG>/); ?
if you expect more than one match in a single string, check out the 'g' modifier in perlop and what it does in scalar context
You could also use a substitution regex with ge modifier, but that sounds a bit like a hack, since you do no substitution
PS: Is this homework, the problem seems somewhat artifical?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Calculations in Regexp
by sumeetgrover (Monk) on Jan 20, 2011 at 15:04 UTC | |
by jethro (Monsignor) on Jan 20, 2011 at 16:49 UTC | |
by locked_user sundialsvc4 (Abbot) on Jan 20, 2011 at 15:19 UTC |