Another Perl Question?

xSirPotsAlotx

New member
how come in my code when I run this, the print and show sorted does not display, it just leaves a blank
#!/usr/bin/perl


$end = 0;
for ( $x=0; ! $end; ++$x )
{
print "Enter number (-1 when done): ";
chomp ($val = <>);
if ($val == -1)
{
$end= 1;
}
else
{
$data[$x]=$val;
}
}



#Sorting the array of numbers
@sorted = sort{$a <=> $b} @data;
print "Sorted numbers:\n";
for ($x=0; $x>$size; $x++)
{
print ("$sorted[$x]\n");
}

#print array values
print (" These are the numbers you entered: \n");
for ($x=0; $x>$size; $x++)
{
print ("$data[$x]\n");
}

#Printing the Largest Number
print "The numbers are $sorted[$size-1]:$sorted[0]\n";
 
Back
Top