my %record; my $item; while (my $line = <DATA>) { chomp $line; if ($line =~ /^(\d+) (.*)$/) { $item = $1; $record{ $item} = " $2"; } else { $record{ $item} .= $line; } } foreach my $item (keys %record) { print "$item $record{ $item}\n"; } __DATA__ 1000001 01.11.199600.00.00001 A1 1 SN Y 2001.11.200400098.0500073.5500083.35 5001.11.1997Professional attendance being an attendance at 5001.11.1997other than consulting rooms 1000002 01.11.199600.00.00001 A1 1 SN Y 2001.11.200400098.0500073.5500083.35 5001.11.1997Professional attendance being an attendance at 5001.11.1997consulting rooms
-Mark
In reply to Re: Format multiline to single line records
by kvale
in thread Format multiline to single line records
by kerrya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |