Programming Perl

Programming PerlSearch this book
Previous: 3.2.1 /PATTERN/Chapter 3
Functions
Next: 3.2.3 abs
 

3.2.2 ?PATTERN?

?PATTERN?

This is just like the /PATTERN/ search, except that it matches only once between calls to reset, so it finds only the first occurrence of something rather than all occurrences. (In other words, the operator works repeatedly until it actually matches something, then it turns itself off until you explicitly turn it back on with reset.) This may be useful (and efficient) if you want to see only the first occurrence of the pattern in each file of a set of files. Note that m?? is equivalent to ??.

The reset operator will only reset instances of ?? that were compiled in the same package that it was.


Previous: 3.2.1 /PATTERN/Programming PerlNext: 3.2.3 abs
3.2.1 /PATTERN/Book Index3.2.3 abs