On Thu, Dec 31, 2009 at 5:46 PM, Peng Yu <pengyu...@gmail.com> wrote:

> In a 'perl -d', I try the following command, but it seems that it is
> not working as I expected. Can I input any arbitrary perl commands in
> the 'perl -d' session as if it is running by a perl interpreter?
>
>  DB<10> my $count = 10;
>
>  DB<11> print $count+1, "\n";
> 1
>
>  DB<12> print $count, "\n";
>
>
>  DB<13> print "$count \n";
>

The debugger wraps you command in eval calls so if you declare a
variable using 'my' it will
immediately exit the scope and get destructed.

You can do the above, just don't use 'my'.
Also you can use 'p'  instead of 'print',

Gabor

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to