| revdiablo | Packing them all into one key just doesn't make me feel warm inside |
| f00li5h | revdiablo: see where it says # same thing using a Schwartzian Transform (no temps) in that article you simply add more or's to the bit below |
| revdiablo | f00li5h: It needs to be an arbitrary number of keys f00li5h: A general purpose routine that takes a list of 1 or more keys, and makes a sort that does that |
| buu | revdiablo: Isn't there a cpan module to do this? Sort::Maker perhaps |
| f00li5h | revdiablo: replace that with a calal to a compare |
| revdiablo | I don't know. I would use it if I knew what it was |
| buu | Sort::ArbBiLex |
| f00li5h | revdiablo: pass it a subref |
| buu | Etc. |
| revdiablo | f00li5h: I want it to take the keys to sort from @ARGV |
| f00li5h | revdiablo: where are you getting the hashes? |
| revdiablo | The hashes are lists of files and associated attributes path, name, mtime, etc |
| f00li5h | how do you know wether to compare as strings or numeric? |
| revdiablo | They are all numeric for now |
| f00li5h | i see |
| revdiablo | I'm sorting by times and sizes |
| f00li5h | while($key = shift @list){ $a->{key} <=> $b->{$key} } that's no good $key = shift @list until ( $a->{$key} <=> $b->$key ); # returns first non-zero comparison, or zero if they're equal |
| revdiablo | Maybe something recursive would do. sub try_another_from_list { return unless @_; my @list = @_; my $key = shift; $a->{$key} <=> $b->{$key} || try_another_from(@list) } |
| f00li5h | that'd do it |