Jun 23, 2001, 12:11 AM
Post #10 of 10
Because I can't find it, I'll freely admit that I may be wrong and will appreciate it if you can point me to the page in MRE that corrects me (or somewhere else).I would have put the page number in the last post if I could have been sure that it's on the same page in your english version as it is in my german version of the book. Anyway, it should at least be some pages before or after my pointer, so in my book ("Reguläre Ausdrücke", 1. ed, 1998, 1. corrected reprint, 2000) what I described is located in figure 7-1 on page 227. It's the first figure in the chapter "Reguläre Ausdrücke in Perl" (Regular Expressions in Perl) and is captioned "Parsing in Perl, vom Programm-Text bis zur Regex-Maschine" (Parsing in Perl, from source code to regex engine).
I can never find exactly what I'm looking for in MRE -- it's definitely not a reference book :)I absolutely agree with you. It's good to read it from the first to the last page, but you can really forget about the index. I've been searching the book for quite some time, too.
Though my tired eyes can't find it, I seem to recall seeing something that supported what I said.I wouldn't be surprised if there's an exception to the above in Perl regexes :-) If you should find what was on your mind, I'd also be glad to know about it. But for the case we're discussing, the way perl behaves and the debug output leave no doubt that interpolation is done before regex compilation.
The grep/glob line will not return anything that doesn't begin with $path, so worrying about a line that doesn't begin with $path isn't necessary. So actually, the ? was completely unnecessary because the line will always begin with $path anyway.That was my first thought when I saw the ?. But because I didn't know about the glob function yet, I accepted the fact that it could return otherwise. The longer I think about it, the more illogical this appears to me.
But now, we can safely remove the ? and can both be happy.
Anyway, thanks for a very interesting discussion! (It made me stay up until 4.30am, read lots about regex again, search some books and manpages, and - not to forget - learn about glob...)
PS: This forum is really great! I've been to some german Perl forums, but they are definetely way behind this one.