Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Sorting challenge

by tobyink (Abbot)
on Jul 22, 2013 at 21:27 UTC ( #1045729=note: print w/ replies, xml ) Need Help??


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; }
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Sorting challenge
Select or Download Code
Re^2: Sorting challenge
by PerlSufi (Friar) on Jul 22, 2013 at 21:35 UTC
    Great, thanks tobyink. I'll give that a try

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045729]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (15)
As of 2015-07-07 14:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls