rethaew has asked for the wisdom of the Perl Monks concerning the following question:
Obviously this code fails, but you can see what I am trying do to. I couldn't find anything like this searching the archives here. Thanks for your help.if ($joe eq "numbers") {my $sortype='<=>';} if ($joe eq "letters") {my $sortype='cmp';} #then go on to work on the hash foreach $key (sort { $hoh{$a}->{value} $sortype $hoh{$b}->{value} } ke +ys %hoa) { blah; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Specify sort method on the fly
by eric256 (Parson) on Jan 20, 2010 at 22:44 UTC | |
by ikegami (Patriarch) on Jan 20, 2010 at 23:29 UTC | |
by eric256 (Parson) on Jan 21, 2010 at 15:05 UTC | |
by SuicideJunkie (Vicar) on Jan 21, 2010 at 16:32 UTC | |
|
Re: Specify sort method on the fly
by BrowserUk (Patriarch) on Jan 21, 2010 at 00:04 UTC | |
|
Re: Specify sort method on the fly
by almut (Canon) on Jan 20, 2010 at 23:17 UTC |