/ Published in: Perl
Useful perl snippet to convert csv docs to xml from Ankh on the freenode #xml irc channel
Expand |
Embed | Plain Text
#! /usr/bin/perl use warnings; use strict; use Text::CSV; # generate XML from CSV files # my $csv = Text::CSV->new( { binary => 1, # binary for utf8, latin1 etc sep_char => "\t" } $csv->eol(" "); foreach (@ARGV) { print "<csv filename=\"$_\">"; while (my $colref = $csv->getline($input)) { print "<row>" . "</row>\n"; } print "</csv>\n"; }
You need to login to post a comment.
