I'm just sharing an learning experience (screwup) that took me half an hour to track down - it was incredibly difficult to find. I literally got it down to a test case of about 20 characters and it still kept blowing up in my face. I was literally commenting out parts of an if statement.
I was using Parse::RecDescent to write (you guessed it), a parser, in which I had put the following code:
if ( ( $val =~ /m/i ) && ( $clamp =~ /y/i ) ) {......}
The parser was blowing up and reporting all sorts of odd errors. If you haven't spotted the error already, take a moment to see if you can spot it.
Here's the correct code:
if ( ( $val =~ m/m/i ) && ( $clamp =~ m/y/i ) ) {......}
Not only was the 'm' in the first conditional being interpreted as the start of a match, the 'y' in the second conditional was being treated as the transliteration operator. So I was copping it coming and going, so to speak.
And this was with strict and warnings switched on. Somehow the evals being used in Parse::RecDescent managed to miss the =~ / and treat the regex as an operator.
This is something I shan't miss in Perl6
____________________
Jeremy
I didn't believe in evil until I dated it.
In reply to Implied operators are maddening by jepri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |