in reply to problem with PDL

...and then you'll get another syntax error (nothing after the last comma).

One world, one people

Replies are listed 'Best First'.
Re^2: problem with PDL
by VSarkiss (Monsignor) on Jun 30, 2005 at 13:52 UTC
      thanks - I often have to parse perl (e.g. searching and extracting from project code) so now I will have to adjust my rules to allow for unclosed lists.

      One world, one people

Re^2: problem with PDL
by marto (Cardinal) on Jun 30, 2005 at 12:23 UTC
Re^2: problem with PDL
by polettix (Vicar) on Jun 30, 2005 at 13:14 UTC
    I cannot install PDL at the moment because I'm not on "my" machine, but I was wondering why this should lead to a syntax error.
    ~/sviluppo/perl> cat prova.pl #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $mat = [ [3.4603, 1.7529, 1.6990,2.1181], [ 2.5459,2.5615,2.2525,2.3606], [ 2.3606, 2.2515, 2.5628,2.5459], [ 2.1181,1.6982,1.7537,3.4603], # <-- trailing comma ]; print Dumper($mat); ~/sviluppo/perl> perl prova.pl $VAR1 = [ [ '3.4603', '1.7529', '1.699', '2.1181' ], [ '2.5459', '2.5615', '2.2525', '2.3606' ], [ '2.3606', '2.2515', '2.5628', '2.5459' ], [ '2.1181', '1.6982', '1.7537', '3.4603' ] ];
    Neither errors nor warnings. I think that the list constructor doesn't complain about trailing "hanging" commas because you're able to cut-and-paste lines (like in this example) without the need to treat the last line differently.

    Is it different when PDL comes in?

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.