Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Robrt (1414)

Robrt
  (email not shown publicly)

robert at perl dot org

Journal of Robrt (1414)

Friday November 04, 2005
12:40 AM

Off By One Error

[ #27439 ]
I updated the Parrot smokeserver today, and suddenly the output display was horribly garbled. I started taking apart the regular expression, converting it into a //x with comments, and suddenly the answer was clear!

Someone added a field to the middle of the data set, and didn't increment all the following field id's. (I.e., $7, $8, $8, $9...).

Lesson #1: Be careful when inserting to the middle of a set. If you can safely insert at the end, do so.

Lesson #2: Don't use the numbered regexp capture syntax for large numbers of capture groups. Use ($foo, $bar, $baz) = /(.)(.)(.)/ instead.

I didn't write the original code - I just had to fix it. (Luckily, I like fixing things.)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.