Hello There. A few things that I didn't knew about regex: 1. When I do m/Literal/, Perl is running some very fast string search, instead on a regex.
2. [AB] is faster then A|B. 3. when storing the regex in a scalar, and doing m/$regex/, Perl will build a regex-machine every time it reaches that line. This can be very wasteful, especially if it's inside a loop. To fix this I should do $regex=qr/the regex/; and then the machine will be created in compile time. 3.1. doing m/$regex/o will create the machine only once per string, on run-time. (I think) 3.2. Can be used to cause perl not to create machines on build time for regex that probably won't be executed. 4. the i switch (m/.../i) kills most of the optimizations. * Taken from a presentation by David Bird. Shmuel. _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
