Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Print variable name/value for all program variables

by Athanasius (Monsignor)
on Nov 08, 2012 at 14:56 UTC ( #1002918=note: print w/ replies, xml ) Need Help??


in reply to Re: Print variable name/value for all program variables
in thread [SOLVED] - Print variable name/value for all program variables

Yes. Include a package declaration at the head of your script, then you can get the names of the variables (and subroutines) as follows:

0:51 >perl -E "package Foo; $x = 42; $y = 'fred'; sub command { print + 'Special command'; } say for sort keys %Foo::;" command x y 0:54 >

Hope that helps,

Athanasius <°(((><contra mundum


Comment on Re^2: Print variable name/value for all program variables
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002918]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-07-24 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls