in reply to Sorting challenge
This condition never happens:
last if ($_ eq '');
So your while loop just keeps going and going. Their test harness is expecting you to return a sorted list of numbers, but your script is just sitting there waiting for more input.
Your input loop should be something like:
chomp(my $count = <>); my @numbers; for (1 .. $count) { chomp(my $line = <>); die if $line < 1 || $line > 1_000_000; push @numbers, $line; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting challenge
by PerlSufi (Friar) on Jul 22, 2013 at 21:35 UTC |