my $gXtext = <<"GXEOF"; ${$gXHHRef}{'picnic theme'} #### use strict; use warnings; use XML::Simple; my @headers = parseCVSLine(); my @record = parseCVSLine(); my @extra_records; while ( my $line = ) { my @xrec = parseCVSline(); push @extra_records, \@xrec if defined } my %data; @data{@headers} = @record; # but I still don't know what to do with those extra records so ... print XMLout(\%data); # yet another lame CSV "parser", use Text::CSV sub parseCVSLine { return $_[0] ? split /,/ : undef; }