in reply to Turning a datafile into a data structure
If you do decide to roll your own rather than use Parse::RecDescent, this is the sort of thing for which the range operator is useful.if(/begin_item/) { while (!/end_item/) { ...deal with data members here... } }
while (my $range = /begin_item/i.../end_item/i) { # skip the first and last lines if you want... next unless $range > 1 && substr($range, -2) ne 'E0'; # deal with data member }
|
|---|