Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Tie::CSV_File 0.21

    Download button

    No screenshots available
    Downloads: 291  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Janek Schleicher | More programs
    Perl Artistic License / FREE
    February 6th, 2010, 02:39 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    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[-1][-1] stands for the last field in the last line, or @{$data[1]} 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[2][4];
     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[1][3] = 4;
     $data[-1][-1] = "last column in last line";
     
     $data[0] = [qw/Name Address Country Phone/];
     push @data, ["Gates", "Redmond", "Washington", "0800-EVIL"];
     push @data, ["Linus", "Helsinki", "Finnland", "0800-LINUX"];

     my @headings = @{ shift @data }; # removes also the first line
     my @last_row = @{ pop @data }; # removes also the last line

     @data = [ [1..3], [4..6], [7..9] ];
     # With default paramaters,
     # the following csv file is created:
     # 1,2,3
     # 4,5,6
     # 7,8,9



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    tie csv_file | Perl array | Perl module | Perl | csv | tie

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM