Simone,
Checking the
CPAN is never a bad idea when trying to solve a new problem.
Text::xSV is one of a handful of modules that make this easy.
#!/usr/bin/perl
use strict;
use warnings;
use Text::xSV;
my $csv = Text::xSV->new( fh => *DATA );
$csv->bind_header;
while ( $csv->get_row() ) {
my $row = $csv->extract_hash();
print $row->{Domain}, "\n";
}
__DATA__
"Column 1","Company Name","Column 2","Domain","Status","Start Date","E
+xpiration
Date","Renew Date"
"1495107228781574","SomeCompany, Inc.","8335788590132972","kerpow.org"
+,"Active",
"Jan 27 2000 9:02PM","May 1 2004 12:34PM","May 28 2005 2:02AM"
"1495107228781574","SomeCompany, Inc.","1802975834647670","squish.com"
+,"Active",
"Jul 15 2004 1:49PM","May 2 2004 11:05PM","May 19 2005 11:05PM"
It should not be hard to take this as an example and use the documentation to get what you want, but I will leave that up to you.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.