in reply to Advanced Sorting

Thanks turnstep, btrott and chromatic!! Now it might get more complicated, or at least messy if I had multiple keys in the hashes, some of which were strings and some of which were numbers. Like in addition to age and name if I had Last Name (string), salary (number), car (string), model year (number), etc. Then I would have to test for every one. That's why I used a reg exp in the first place. But I like the idea of testing outside of the sort for efficiency, I will definitely use that.

Replies are listed 'Best First'.
RE: RE: Advanced Sorting
by chromatic (Archbishop) on Apr 20, 2000 at 04:18 UTC
    You could use a regex to test for appropriate key names. Or you could do some testing with my technique (returning an anonymous sub) and change the test to see if the datatype is a number if you take a look at How to identify a number datatype in a string?. It's probably lots simpler just to keep a data structure of appropriate fields guaranteed to hold strings or numbers, though.