Change the output delimiter from space to comma

master
Koosha Khajeh Moogahi 2012-12-06 00:47:01 +03:30
parent b3ad72ad6a
commit 2856e26141
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ handle remainder => sub {
@numbers = @numbers[0..MAX_LIST_SIZE - 1];
}
my @sorted = sort { $ascending ? $a <=> $b : $b <=> $a } @numbers;
my $list = join(' ', @sorted);
my $list = join(', ', @sorted);
return sprintf("$list (Sorted %s)", $ascending ? 'ascendingly' : 'descendingly');
}
return;

View File

@ -12,8 +12,8 @@ ddg_goodie_test(
[qw(
DDG::Goodie::Sort
)],
'sort -1, +4, -3, 5.7' => test_zci('-3 -1 +4 5.7 (Sorted ascendingly)'),
'sort desc -4.4 .5 1 66 15 -55' => test_zci('66 15 1 .5 -4.4 -55 (Sorted descendingly)'),
'sort -1, +4, -3, 5.7' => test_zci('-3, -1, +4, 5.7 (Sorted ascendingly)'),
'sort desc -4.4 .5 1 66 15 -55' => test_zci('66, 15, 1, .5, -4.4, -55 (Sorted descendingly)'),
);
done_testing;