in reply to formatting help

Here's a home brewed example of how to get your format. Similar to some others you have and probably will again receive.
#!/usr/bin/perl -w my %segment = (); $file = "source_data.txt"; # Open the source file ... open (FILE,$file)||die "Can't open the source data file $file\n$!\n"; while(<FILE>){ if (/,/){ chomp; s/\"//g; # no more double quotes my ($segname, @rec) = (split(/,/))[2,0,1]; push @{$segment{$segname}}, \@rec; } } close (FILE); foreach (keys %segment) { print "$_\n"; # let's get the new comma + space in there and print foreach (@{$segment{$_}}) { print join(", ",@$_) . "\n"; } print "end\n"; }