What's the difference between x and p in perl -d?
x|m expr Evals expr in list context, dumps the result or lists methods.
p expr Print expression (uses script's current package).
They seems identical to开发者_StackOverflow社区 me,what's different?
Also,is there any short cut like up/down arrow key in shell environment?
See perldoc perldebug:
p expr Same as "print {$DB::OUT} expr" in the current package. In particular, because this is just Perl's own "print" function, this means that nested data structures and objects are not dumped, unlike with the "x" command.
and
Readline Support / History in the debugger As shipped, the only command-line history supplied is a simplistic one that checks for leading exclamation points. However, if you install the Term::ReadKey and Term::ReadLine modules from CPAN (such as Term::ReadLine::Gnu, Term::ReadLine::Perl, ...) you will have full editing capabilities much like GNU readline(3) provides. Look for these in the modules/by-module/Term directory on CPAN.
Simply put: x
prints data structures, p
prints scalar values. Try both: p {x=>1, y=>2}
is hardly meaningful, but x {x=>1, y=>2}
makes sense.
精彩评论