in reply to Re: Sort problem
in thread Sort problem
Thanks dws. First for seeing past my clumbsiness:)
Second catching the significance of embedded spaces.
Third for showing me where I was going wrong. The nearest I had got was
Which gave meprint "@$_" for sort{ my ($o, $i) = (0,0); $i++ until ($i < @$a or $i < @$b) and $o =($a->[$i] cmp $b->[$i]) or $o = @$a <=> @$b; $o; }@deps;
Close, but no cigar. qw[C G F H] was sorting above qw[C G F E D] but for the life of me I couldn't see why.C B A C G F H C G F E D C G F H I C G F H J M K M N M N Q P O U S V T
Your code made me realise what was wrong and led to this
print "@$_" for sort{ my ($o, $i) = (0,0); $i++ until ( $i < @$a or $i < @$b ) and $o=( $a->[$i] cmp $b->[$i] ); $o || @$a <=> @$b; }@deps;
Which I realise won't win any prices in the clarity-at-all-costs stakes, but I find readable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Sort problem
by tachyon (Chancellor) on Feb 26, 2003 at 20:55 UTC | |
by BrowserUk (Patriarch) on Feb 26, 2003 at 21:09 UTC | |
by runrig (Abbot) on Feb 26, 2003 at 21:10 UTC | |
|
Re^3: Sort problem
by hv (Prior) on Feb 27, 2003 at 00:17 UTC | |
by BrowserUk (Patriarch) on Feb 27, 2003 at 08:07 UTC |