Regarding NiceSlice, I made a further couple of tests: Take the program #! /usr/bin/env perl use PDL; BEGIN{$PDL::NiceSlice::debug_filter=1;} use PDL::NiceSlice; my $x=pdl(1); my $V=$x/$x((0))/2;
A add the ...debug_filter=1 line to print debugging info. I run it: $ ./rem.pl ***** Input: my $x=pdl(1); my $V=$x2; ***** Output: my $x=pdl(1); my $V=$x2; *** Final: my $x=pdl(1); my $V=$x/$x((0))/2; syntax error at ./rem.pl line 6, near "$x(" Execution of ./rem.pl aborted due to compilation errors. So it seems that the source filter por NiceSlice doesn't receive all of the code. The fragment /$x((0)) is removed from the line $x/$x((0))/2, so the filter only receives $x2. As there is no slicing in it, the filter returns its input unmodified and then Filter::Simple puts the /$x((0))/ back in to produce the final code which is invalid perl. So it seems that Filter::Simple is somehow confused by the two slashes. If I remove $x/ or /2 the code works. I thought it might be related to /.../ looking like a search pattern. However if I change $x/ by $x*1/ #! /usr/bin/env perl use PDL; BEGIN{$PDL::NiceSlice::debug_filter=1;} use PDL::NiceSlice; my $x=pdl(1); my $V=$x/$x((0))/2; and run it, $ ./rem.pl ***** Input: my $x=pdl(1); my $V=$x*1/$x((0))/2; ***** Output: my $x=pdl(1); my $V=$x*1/$x->slice([0,0,0])/2; *** Final: my $x=pdl(1); my $V=$x*1/$x->slice([0,0,0])/2; then the fragment /$x((0))/ is not removed from the input. Regards, Luis -- o W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ Av. Universidad s/n CP 62210 | (*)/\/ \ Cuernavaca, Morelos, México | moc...@fis.unam.mx /\_/\__/ GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general