in reply to Re^7: Common Perl Pitfalls
in thread Common Perl Pitfalls
Don't get me started on \d! Whoever decided to include "something that might be understood as a digit in a language/charset I've never ever heard of" in \d made a huge huge mistake. Out of ten thousands of \d, there's maybe one where this nonsense is what was meant. I do believe even now it's not too late to fix this insanity. The change would fix many times more scripts/modules than it would break.
And what I meant regarding the speed is the difference between
andmy $foo = qr/.../; my $bar = qr/..../; ... while (<>) { ... if (/$foo(?:$bar)+/) { ...
In the later case the stringification and the compilation of a longer regexp happens just once.my $foo = qr/.../; my $bar = qr/..../; my $foobar = qr/$foo(?:$bar)+/; ... while (<>) { ... if (/$foobar/) { ...
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Common Perl Pitfalls
by JavaFan (Canon) on Apr 11, 2012 at 20:57 UTC | |
by Jenda (Abbot) on Apr 11, 2012 at 22:48 UTC | |
by JavaFan (Canon) on Apr 11, 2012 at 23:36 UTC |