use $/=undef to slurp all the file into a string. Replace all \n with commas except for the 12th?
$/=undef; # Slurps all data in file. $_=<DATA>; # Put it in $_, convenient for regex. my $lines=0; # Line count $. might suffice and then the pre increme +nt can be dropped. my $records=11; # Number of lines in a record. s/\n/(',',"\n")[++$line%$records==0]/eg;# replaces all \n with commas +except the recordth. print $_;
--
Brother Frankus.
¤
In reply to Re: Parsing multi-line records
by frankus
in thread Parsing multi-line records
by chuntoon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |