Tie::CSV_File

Ties a csv-file to an array of arrays
Download

Tie::CSV_File Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Janek Schleicher
  • Publisher web site:
  • http://search.cpan.org/~bigj/

Tie::CSV_File Tags


Tie::CSV_File Description

Ties a csv-file to an array of arrays Tie::CSV_File is a Perl module that represents a regular csv file as a Perl array of arrays. The first dimension of the represents the line-nr in the original file, the second dimension represents the col-nr. Both indices are starting with 0. You can also access with the normal array value, e.g. $data stands for the last field in the last line, or @{$data} stands for the columns of the second line.SYNOPSIS use Tie::CSV_File; tie my @data, 'Tie::CSV_File', 'xyz.dat'; print "Data in 3rd line, 5th column: ", $data; untie @data; # or to read a tabular, or a whitespace or a (semi-)colon separated file tie my @data, 'Tie::CSV_File', 'xyz.dat', TAB_SEPARATED; # or use instead COLON_SEPARATED, SEMICOLON_SEPARATED, PIPE_SEPARATED, # or even WHITESPACE_SEPARATED # or to read something own defined tie my @data, 'Tie::CSV_File', 'xyz.dat', sep_char => '|', sep_re => qr/\s*\|\s*/, quote_char => undef, eol => undef, # default escape_char => undef, always_quote => 0; # default $data = 4; $data = "last column in last line"; $data = ; push @data, ; push @data, ; my @headings = @{ shift @data }; # removes also the first line my @last_row = @{ pop @data }; # removes also the last line @data = , , ]; # With default paramaters, # the following csv file is created: # 1,2,3 # 4,5,6 # 7,8,9 Requirements: · Perl


Tie::CSV_File Related Software