Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Jürgen Exner
May 14, 2009, 12:53 am
rate this thread
You are passing a list of two scalars to the sub, these are copied into
a hash, which would mean you got a hash with one element, the value of
$verse being the hash key and the value of $script being the hash value
for this element.
You need to be more specific. Do you want to print the keys or the
values sorted by the alphabetical order of the keys or by the
alpabetical order of the values? Either one is easy enough.
Can you reconstruct $verse (i.e. the hash key) from that particular
chapter and verse? If yes, then access will be O(1) in the general case.
You can't get any faster than that.
If you cannot reconstruct the hash key based on chapter and verse and
searching for that is _the_ critical operation in your program, then I
would suggest to redesign the datastructure such that a combination of
chapter and verse can be used as the key.
Or use a database system instead.
- » FAQ 7.21 How do I redefine a builtin function, operator, or method?
- — Next thread in » PERL Discussions
- » How do I turn a list of strings into a list of regexps?
- — Previous thread in » PERL Discussions