Ken Lehman <[EMAIL PROTECTED]> wrote: : : I would like to write a function that will get : all the global variables that are declared in : my script plus their values( which will all : be strings if that matters). This is what I : have so far: : : my ( $varName, $globValue ); : : while ( ($varName, $globValue) = each %main:: ) : { : print "\$$varName $globValue \n"; : } : : : This prints a whole lot of stuff including : function names but the variables are not in : here.
Then the variable you are referring to are probably lexical (declared with 'my'). Lexical variables do not show up in the symbol table (%main::). : My goal is to have this function pick : up the variables dynamically every time : the script is run, get the values and : do some verification before getting : into the meat of the script, without : having to add or remove the variables : manually from the sub whenever I add : or remove a variable from the script. : Thanks in advance for any help Another poster mentioned the idea of creating a module full of constants. This allowed him to use any data type and to use subroutines for very complex data. All the constants could be exported when the module is "use"d. This still imports everything to the "main" namespace and since constants are traditional ALLCAPS, provides the next programmer to easily recognize that they may indeed be constants imported into the script. HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]