Hi.
The part of this topic relating to regular expressions reminded me of the section in Conway's
Perl Best Practices. If I understand Conway, he would suggest writing the RE like this:
Code:
next if $i =~ m{ ^ [.] [.]? $ }xms;
I think his approach is useful: balance readability and maintainability with speed. I cannot say that my fingers are yet familiar typing the braces (especially for multi-line patterns) and then the
xms modifiers after every match expression, but it's not as foreign as it once was. It is clearly more typing, but I agree that the single-character classes are more readable compared to
leaning toothpicks.
In addition to readability, he also writes about issues affecting performance.
If one does a lot of perl, I think it's a useful book, particularly if one is writing code that someone else may need to maintain. Many people in the local perl-mongers group seem to like it ... cheers, makyo
( 37 )