Gavin Bowlby wrote:
So
(\.)?

differs from

(\.?)

in that there is no match in the first case, but there is a match in the
second case?

I'm still confused as to why the placement of the ? operator inside or
outside the parentheses makes a difference.

I thought the parentheses were only there to bind the result to a $N
variable, not to change the operations of the pattern matching itself.
Parentheses are also used for grouping, as in:

 /(foo|bar)/

With '(\.)?' the group is optional; with '(\.?)' the string inside the group is optional, the group is not.

--

Just my 0.00000002 million dollars worth,
  --- Shawn

"Probability is now one. Any problems that are left are your own."
  SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is available at http://perldoc.perl.org/

"This statement is unprovable." -- Kurt Godel


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to