# trim the # marks $_mergeFields =~ s/#//g; # list of field names my @field_names = split ';', $_mergeFields; # list of lines from the data my @records = split /[|]/, $_list_to_send_to; my $template = q[