in reply to Re: case-insensitive hash keys
in thread case-insensitive hash keys
Maybe I'm missing something here, but it seems to me that this would be a good Perl intepreter flag... i.e., that all associate array keys should be treated case-insensitively. The interpreter would implicitly run "lc" when computing the hash value for storing or retrieving a value.
The background here, as I alluded to above, is that I've got about 20,000 lines of code for a web system. Alot of my application is database-driven, and I have a module that just contains functions to retrieve rows from numerous tables.
The mechanism for returning data from the retrieve functions is a pointer to a hash table (of the returned row). The keys in the hash are case-sensitive names of the fields. So the risk here is that someone who maintains this code makes a change and typos a hash key. Unlike with using strict vars, where Perl warns you if it thinks you've made a typo in a variable name, it would be very difficult to track down a typo in a hash key.
Any other thoughts?
thanks
MFN
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: case-insensitive hash keys
by BrowserUk (Patriarch) on Aug 22, 2004 at 03:14 UTC | |
by ManFromNeptune (Scribe) on Aug 22, 2004 at 03:52 UTC | |
by BrowserUk (Patriarch) on Aug 22, 2004 at 04:04 UTC |