in reply to About variable names

Your answer has been provided, but just a side note on implementation. Are you using the @keys array to help populate the %list_of_refs, or just as a way of keeping track what keys are within %list_of_refs? If you have the @keys array just so you can say for (@keys) {}, then take a look at keys(). Then you can do something along the lines of for (keys %list_of_refs) {} or my @keys = keys %list_of_refs; for (@keys) {}. This way, you won't have to keep a separate list; you can just generate it automatically whenever you need it :)

Replies are listed 'Best First'.
Re: Re: About variable names
by Anonymous Monk on Nov 20, 2003 at 15:17 UTC

    I created a bunch of global hashes that contain references to all sorts of hashes, arrays, variables, and subs, which may or may not be defined, depending on whether or not they are needed. Typically (99%+ of the time) I will not use all of the references within any given global hash.

    However, many of the places where I created the more localized variables, I have several different hashes which have the same keys, but different values or references. So I use an array to keep track of the keys. It's made that way mostly for readability's sake (I use fairly long and descriptive variable names); I plan to pass this code on to other maintainers after I get done with it.

    I really appreciate the tip, though. I was aware of the keys() function, but never really thought about using it :)