I am looking for best, easiest way to do something like:
$var1=\"value\";
bunch of code.....
**print allVariablesAndTheirValuesCurrentlyDefined;**
The global symbol table is %main::
, so you can get global variables from there. However, each entry is a typeglob which can hold multiple values, e.g., $x, @x, %x, etc, so you need to check for each data type. You can find code that does this here. The comments on that page might help you find other solutions for non-global variables (like lexical variables declared with "my").