http://www.perlmonks.org?node_id=1002918


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