in reply to Data::Table showing error

Hello ravi45722,

The syntax in your post appears to be incorrect. If you have a csv file that lacks a header, create the Data::Table object like this:

my $t = Data::Table::fromCSV("ravi.csv", 0);
Could you post an example showing the format of your csv file? Also, are you using an up-to-date version of Data::Table? The current version is 1.72. You can get the version by running this one-liner:
perl -MData::Table -e 'print "$Data::Table::VERSION\n"'

Replies are listed 'Best First'.
Re^2: Data::Table showing error
by ravi45722 (Pilgrim) on Oct 27, 2015 at 06:27 UTC

    Its showing it as 1.68.

     Tue Oct 13 00:10:00 2015|33594|959796245242|08211019|Tue Oct 13 00:10:00 2015|Tue Oct 13 00:10:00 2015|CMT|Undelivered|none|Submit|0|SMSC_PR_LC_SMSC_InvalidDestAddress|GSM|INVALID|ASCII|92|92|no||no|no||None|No|NO|no|no|0|0|0|0||959790000028||8|0||0|no|no|default_billing|-1|0|no|no|1|1|1|1|0|1|0|0|||||Tue Oct 13 06:10:00 2015|SR|||IV|011809614446716000046|||0|0||0|0||0||||08211019||||||||||||||||||

    This is my log file(one sample). In this I want to group all the events and counts that where 10 (Submit),13 (GSM), 14 (SMPP) occured. Here (in example) the fields are different 13(GSM),14 (INVALID). But I need to count as per my condition

      The default separator for the fromCSV command is a comma, i.e. comma-separated values. Your file appears to contain pipe-separated values, so you need to define the delimiter. The Data::Table documentation for the fromCSV command states,
      if the delimiter or the qualifier is a special symbol in regular expre +ssion, you must escape it by '\'. For example, in order to use pipe s +ymbol as the delimiter, you must specify the delimiter as '\|'.
      Try this with your file,
      my $t = Data::Table::fromCSV("ravi.csv", 0, undef, { delimiter => '\|' + });
        #!/usr/bin/perl use strict; use warnings; use Data::Table; my $t = Data::Table::fromCSV("/root/prac/Telenor_CDR/SMSCDR_POSTPAID_1 +51013000000_10.84.0.29_AS.log", 0, undef, { delimiter => '\|'}); my $t2 = $t->group(["col1","col9"]); print $t2->csv;

        Errors

         Can't use string ("94") as an ARRAY ref while "strict refs" in use at /root/perl5/lib/perl5/Data/Table.pm line 1308, <$SRC> line 1.