or when ignoring the case completly:for$a(@a=<>){$_=$a;while(s/^(\d+)/push(@{$a{$a}},$1-256),''/e||s!^(.)! +push(@{$a{$a}},2**32-256+2*ord(lc$1)+(lc($1)eq$1)),''!e){}}sub a{$a{$ +a}[$i=shift]<=>$a{$b}[$i]or$i>length($a)or a($i+1)}print sort{a}@a
sorting chars before numbers would be easier and allow for more input values to be sorted correctly:for$a(@a=<>){$_=$a;while(s/^(\d+)/push(@{$a{$a}},$1-256),''/e||s!^(.)! +push(@{$a{$a}},2**32-256+ord(lc$1)),''!e){}}sub a{$a{$a}[$i=shift]<=> +$a{$b}[$i]or$i>length($a)or a($i+1)}print sort{a}@a
for$a(@a=<>){$_=$a;while(s/^(\d+)/push(@{$a{$a}},$1),''/e||s!^(.)!push +(@{$a{$a}},-256+ord(lc$1)),''!e){}}sub a{$a{$a}[$i=shift]<=>$a{$b}[$i +]or$i>length($a)or a($i+1)}print sort{a}@a
In reply to Re: Golf: 3 hole golf game
by Beechbone
in thread Golf: 3 hole golf game
by theroninwins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |