You need to wrap that whole section in if ($1 isnum) { } because it also passes $1 == begin and $1 == end.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!