or download this
$/=undef; # Slurps all data in file.
$_=<DATA>; # Put it in $_, convenient for regex.
...
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 $_;