Quite misterious:

I simplified the code to the following:

   #! /usr/bin/env perl
   use PDL;
   use PDL::NiceSlice;
   my $x=sequence(1);
   my $V=$x/$x((-1));
   #my $w=$A/$x((-1));

and it fails with the message

syntax error at rem.txt line 5, near "$x("

The error corresponds to the line 'my $V=$x/$x((-1));'

Nevertheless, if I remove the last comment, as in

   #! /usr/bin/env perl
   use PDL;
   use PDL::NiceSlice;
   my $x=sequence(1);
   my $V=$x/$x((-1));

the error message disappears. If I move the comment to the
previous line it also disappears, but if I put it in the same line
after the statement the error reappears. If I remove $x((-1)) from the
comment the error also disappears. I guess it would be useful to see
what is the output of the NiceSlice filter that contains the error and
that is fed to Perl, but I don't know much about input filters.

Regards,
Luis


On Thu, Nov 03, 2022 at 03:58:23PM +0300, Yury Pakhomov wrote:
> Hello All!
>
> After update my system (Slackware 15) some PDL programs crashed.
> For example, below is simple part of my code.
>
> code.pl
> ________________________________
> #! /usr/bin/perl -w
> #use v5.36;
> use PDL;
> use PDL::NiceSlice;
>
> my $c=299792;
>
> my $x=5000+sequence(100);
>
> # Average step in lam
> my $dx=($x((-1))-$x((0)))/(nelem($x)-1);
>
> # Minimal step in V scale
> my $dV=$c*$dx/$x((-1));
>
> # Create uniform V scale (km/s)
> my $n=int(log($x((-1))/$x((0)))/log(1+$dV/$c))+2;
> my $v=sequence($n)*$dV;
> _________________________________
>
> # perl -c code.pl
> syntax error at bad2.pl line 14, near "$x("
> bad2.pl had compilation errors.
>
> If I change line 14 to "my $dV=$c*$dx/$x->at(-1)->sclr;" then works fine.
> Also the original code in other computer (perl 5.34) works fine too.
> Moreover, if delete last three lines in code.pl, then it works!
> Where source of these errors?
>
>
>
>
> _______________________________________________
> pdl-general mailing list
> pdl-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pdl-general
>

-- 

                                                                  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

Reply via email to