in reply to Parse::RecDescent problem (wrong example in perl.com article)
Talk about a bug that took me an hour to fix. Changing
to{ return $main::VARIABLE{$item{VARIABLE}} }
does the trick. For completeness, I would change the other two return FOO to $return = FOO also.{ $return = $main::VARIABLE{$item{VARIABLE}} }
I think you should write to the author of that tutorial and give him a heads-up. Also, this is off-topic, but the line /\w[a-z0-9_]*/i isn't quite right. Indeed, /\w/ is /[a-z0-9_]/i, so what is probably intended is /[a-z]\w*/i. In this case, it makes little difference (the former allows variables beginning with underscore), but if some code is rearranged then errors might pop up.
|
|---|