in reply to Re^3: Data::Table showing error
in thread Data::Table showing error

#!/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.

Replies are listed 'Best First'.
Re^5: Data::Table showing error
by kevbot (Vicar) on Oct 27, 2015 at 08:10 UTC
    I think you may have stumbled upon a bug in Data::Table. It does not appear to be handling the trailing blank columns properly. If I use your example data, I get the same error as you.
    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_P +R_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|0118096144 +46716000046|||0|0||0|0||0||||08211019||||||||||||||||||
    However, if I add a value to the end of the line (to give a non-empty column), then it works. For example, if I add aaa as the last column,
    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_P +R_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|0118096144 +46716000046|||0|0||0|0||0||||08211019||||||||||||||||||aaa
    then the code runs without errors. I will try to take a closer look at this, and perhaps submit a bug report if I can't find a work around.

      Thanks. Is "Text::CSV" works like an alternative for me???