in reply to Build a list of defined var's

It could be easy with a little preparation. You would have to define all of your variables as entries in a hash. Then you could iterate through all of the keys in the hash.
$variable{'a'} = 1; $variable{'b'} = $variable{'a'} + 1; foreach my $k (keys %variable) {$variable{$k} = $reset_value;}
Of course your code would look rather ugly. But sometimes this approach can be useful.

Replies are listed 'Best First'.
Re^2: Build a list of defined var's
by CountZero (Bishop) on Oct 20, 2009 at 18:48 UTC
    Nice try! As a matter of fact, all variables are already in a hash: %main:: for the main package.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James