Chris is addressing the question more thoroughly, but I'll chime in:
the PDL shell is not intended to execute *exactly* the same way as
perl/PDL itself, because it is intended to be interactive. In
particular, if there is no enclosing block then the line is executed
immediately in the shell, while in Perl it is not executed until an
entire script is compiled. This is a subtle but important difference
-- for example, as Chris pointed out, "my" variables aren't preserved
across execution lines in perldl (though pdl2 apparently preserves
them properly). Also, constructs like:
$a = $one
+ $two;
(with a line break in the middle) don't work the same: "$a=$one" is
executed immediately in the shell, and "+$two" is interpreted as a
unary-plus term and discarded; while perl itself of course places the
sum into $a.
That subtle difference is the reason for the compiled chain code
"pdl", which allows you to run shell log files directly as scripts via
"#!/usr/bin/pdl" -- otherwise there would be no conveniently way to
reproduce exactly the behavior of an interactive shell from its log
file.
On Jul 20, 2011, at 7:39 AM, Vijayaraj wrote:
Hello PDL users,
I am following the tutorial from this link,
http://pdl.perl.org/?docs=Indexing&title=PDL::Indexing
when I execute the pdl code from pdl> environment, I can change the
parent pdl by modifying the child pdl, and the same code with perl
program does not change the parent pdl. is there any difference in
executing the pdl code from pdl> environment to perl normal
programming code?
Vijay.
_______________________________________________
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