It produces two hits - an "a" and an empty string. Yet if both conditions fail (by changing $_ to "zzzzz"), it produces no hits, as expected. Why the empty string? And can I avoid it, other than by post-processing @hits? Thanks!$_ = "caaat"; my @hits = m/(?:c(a)|k(t))/g; foreach (@hits) { print "|$_|\n" }
In reply to empty hits with regex by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |