Change your print loop to:
while ( defined( my $token = $lexer->() ) ) { next if ! defined $token or ! defined @$token; # Skip blank lines +- no tokens my ( $label, $value ) = @$token; print "$label => $value\n"; #print Dumper($token); }
to handle blank and non-token containing lines
In reply to Re: Using HOP::Lexer to parse a document
by GrandFather
in thread Using HOP::Lexer to parse a document
by monsterzero
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |