|
NAMEIO::CSVHeaderFile - Perl extension for CSV Files SYNOPSIS # to read ...
use IO::CSVHeaderFile;
my $csv = IO::CSVHeaderFile->new( "< $filename" );
while(my $hash = $csv->csv_read ){
print "$hash->{ColHeaderTitle}\n";
}
$csv->close;
# or for same named columns
my $csv = IO::CSVHeaderFile->new( "< $filename" );
my $data;
while(@array = $csv->csv_read ){
for(my $i=0; $i< @array; $i++) {
print "Column '$array[$i]': $array[$i]\n";
}
print "-- end of record\n";
}
$csv->close;
# to write ...
use IO::CSVHeaderFile;
my $csv = IO::CSVHeaderFile->new( "> $filename" ,
{col => ['ColHeaderTitle1','ColHeaderTitle2','ColHeaderTitle1'], noheaders => 1} );
$csv->csv_print({ColHeaderTitle1 => 'First', ColHeaderTitle2 => 'Second'}) or return;
$csv->csv_print(['Uno', 'Duo', 'Tre']) or return;
$csv->csv_print(
ColHeaderTitle1 => 'One',
ColHeaderTitle2 => 'Two',
ColHeaderTitle1 => 'Three with the same name as One'
) or return;
$csv->close;
DESCRIPTIONRead from and write to csv file. EXPORTNone by default. FUNCTIONS
AUTHORVasek Balcar, <vasek@ti.cz> SEE ALSOIO::File, IO::Handle, perl. POD ERRORSHey! The above document had some coding errors, which are explained below:
|