in reply to Re: Using HOP::Lexer to parse a document
in thread Using HOP::Lexer to parse a document

! defined @$token

A string is being returned from the lexer, and since it's not a reference, trying to dereference it is an error. Maybe you want:

 ! ref($token)

But then the lexer is still returning too many TEXT tokens (line 2 and 3 of the output in the OP), so something else needs to be fixed. (update: and I think the fixing needs to be done in HOP::Lexer)(update2: nope, it was the TEXT regex that needed to be fixed)

Replies are listed 'Best First'.
Re^3: Using HOP::Lexer to parse a document
by GrandFather (Saint) on Feb 09, 2006 at 20:36 UTC

    Hmm, a bit of C think showing through in my Perl :(. Better would be:

    next if 'ARRAY' ne ref $token; # Skip blank lines - no tokens

    DWIM is Perl's answer to Gödel
Re^3: Using HOP::Lexer to parse a document
by monsterzero (Monk) on Feb 09, 2006 at 19:23 UTC
    Thanks for your reply :-) When I applyed your first suggestion it worked great!!