in reply to Parse::RecDescent startup/input error
the return from the parser will be the datastructure you created and you can then print/manipulate it outside of the parser. Not tested at all.file: hdr body ftr { $return = {hdr => $item{hdr}, body => $item{body}, }; } body: batch(s) hdr: /^HDR.*\\n/ ftr: /^FTR.*\\n/ batch: bathdr tran(s) batftr { $return = {bathdr => $item{bathdr}, tran => $item{"tran(s)"}, }; } bathdr: /^BHD.*\\n/ { $return = substr($item[1], 30, 3); } batftr : /^BFT.*\\n/ tran: TR1 TR2 { $return = {%{$item{TR1}}, %{$item{TR2}}, }; } TR1: /^TR1.*\\n/ { $return = { str4 => substr($item[1], 35, 8), str2 => substr($item[1], 122, 5), }; } TR2: /^TR2.*\\n/ { $return = {str3 => substr($item[1], 103,2)}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parse::RecDescent startup/input error
by JESii (Novice) on Aug 06, 2004 at 17:46 UTC |