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.
|