#! perl -slw use strict; use Data::Dumper; my %data; my $current_key; while( <DATA> ) { my ($key, $value) = m[(^[\w]{2})?\s+(.*$)]; if( defined $key ) { last if $key eq 'ER'; push @{ $data{$key} }, $value; $current_key = $key; } else { push @{ $data{$current_key} }, $value; } } print Dumper \%data __DATA__ T1 Line1 T2 Line2 Line3 Line4 T3 Line5 Line6 ER
In reply to Re: Parsing a Tagged File Format
by Anonymous Monk
in thread Parsing a Tagged File Format
by arunhorne
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |