The NiceSlice syntax is accomplished via a Perl source-code filter that preprocesses your script even before Perl gets to it. To turn that on you have to say "use PDL::NiceSlice" somewhere at the top of your script, to turn on the nice slicing.
The autoloader does that for you in your .pdl files, but in Perl scripts you have to remember to invoke NiceSlice in every file that uses it. That is a wart having to do with the fact that we're changing the Perl 5 syntax. It will hopefully go away if Perl 6 is ever released (because then we will have run-time access to the parser). Cheers, Craig On Apr 1, 2009, at 12:54 PM, Maggie wrote: > Problem: > perldl shell complains about syntax error in my script, but the same > lines were run just fine if typed into the shell. > > The file try.pl has these 2 lines > > $a = sequence 4, 2; > p $a( ,1); > > perldl> do 'try.pl' > > syntax error at /data/home/maggie/try.pl line 2, near "$a( " > > Now, I checked that NiceSlice is enabled in the shell. > > perldl> $a = sequence 4, 2 > > perldl> p $a( ,1) > > [ > [4 5 6 7] > ] > > What's going on? > > Thanks! > Maggie > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
