in reply to (jeffa) Re: How do I re-read a line?
in thread How do I re-read a line?

This seems to work fine for me...
my($index, $record) = (0); while (<$fh>) { chomp; s/\cM//; if (/^(\d)-RECORD$/) { $index = $1; $record->[$index]->{items} = []; } elsif (/ITEMNAME-(.*)/) { $record->[$index]->{name} = $1; } elsif (/ITEM \d-(.*)/) { push @{$record->[$index]->{items}}, $1; } }
UPDATE: jeffa pointed out an undef in the record set. that's due to the lack of a 0-RECORD. Ignore it, or do $index = $1 -1, as you will.

--
perl -pew "s/\b;([mnst])/'$1/g"