in reply to Long Versions
BoulderBum, be not dismayed... for I to am learning perl, and have honed stupidity to a fine art. The monestary here is a world of help. The 3rd edition of PP, while a little better than the 2nd, is also over 1000 pages, and my library wanted it back.
My question is for the more seasoned responders. Is the example cited only expecting to print when ALL of the vowels are contained in the line, or when ANY vowel is found. At first I thought it was looking for ANY vowel, but the 'and' would imply they all must be matched. Or is it the FIRST one matched causes a print, unless the /g is present. Just testing my recollection...it's an age thing. Thanks.
Re^2: Long Versions
by Joost (Canon) on Sep 29, 2007 at 00:07 UTC
|
ALL regexes must match for the line to be printed. That's what && means.
More subtly, if the first (or any later) regex does not return a true value (i.e. it doesn't match) the later of the && conditions aren't even executed/tried, since by then, the total result will always be false.
This distinction is subtle but it can have quite profound effects if interpreted/understood (in)correctly. See also Short-circuit_evaluation
| [reply] |
|