perllove has asked for the wisdom of the Perl Monks concerning the following question:

Hello, is there a way to see all the variables which I have created in the script at any point using the debugger? The syntax for a single variable is given as x varname. For multiple variables, the syntax is X package name , but what if my script does not have any package name? As some one suggested I even tried using main, but it does not help. Also many of the times I am getting default system variables like $$, $\ etc..

Replies are listed 'Best First'.
Re: Seeing all the variables in debug mode
by swampyankee (Parson) on Jun 12, 2007 at 03:40 UTC

    Try V or X (quoted from perldebug):

    V [pkg [vars]] Display all (or some) variables in package (defaulting to main) us +ing a data pretty-printer (hashes show their keys and values so you s +ee what's what, control characters are made printable, etc.). Make su +re you don't put the type specifier (like $) there, just the symbol n +ames, like this: V DB filename line Use ~pattern and !pattern for positive and negative regexes. This is similar to calling the x command on each applicable var. X [vars] Same as V currentpackage [vars].

    Note that I rarely use either.

    You could also try the Perl debugger using a Tk GUI.

    emc

    Any New York City or Connecticut area jobs? I'm currently unemployed.

    There are some enterprises in which a careful disorderliness is the true method.

    —Herman Melville
      Thanks for the reply. But I am not out of my problem. When I do this X ~$(.*) I get only some variables. i.e variables in the current package. Sorry, I dont know about jobs, I am a college student.