Stop triggering for single input query on sort_goodie

The sort_goodie should not be triggered for single numbers (input)
query. This could be fixed by using a return statement check on handler.

* goodie not triggered for single number (input)

See also: #3144
master
NaveenKarippai 2016-05-29 15:55:26 +00:00
parent c1e88730d9
commit b9e8d190c4
1 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,8 @@ handle remainder => sub {
my $count = 0;
@numbers = map { 0 + $_ } grep { ++$count <= MAX_LIST_SIZE } @numbers; # Normalize and limit list size.
return unless $count > 1;
my $unsorted_list = join($delim, @numbers);
my $sorted_list = join($delim, sort { $ascending ? $a <=> $b : $b <=> $a } @numbers);
my $dir = $ascending ? 'ascendingly' : 'descendingly';