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 (Canon)
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

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 exploiting the Monastery: (3)
As of 2016-09-25 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (462 votes). Check out past polls.