Can anyone help me resolving below mentioned problem

print"enter the required No. of numbers to be inputed : f";
print"enter the number";
# chomp $data[$i];
$sum=$sum + $data[$i];}

# for($j=0;$j=$data[$i];$j+=1)
print"the entered numbers are",@data,"\n";
print"sum of the number:",$sum,"\n";
print"Average value the numbers:",$sum/$N,"\n";

for ($j=0;$j < $lengt;$j++)
{# print $sorting[$j],"\n";

$X= (@sorting[($j-1)/2]+ @sorting[$j/2])/2;
print"the median is :$X";

Q:the median is the middle value if the numbers have been sorted in
ascending order (for even numbers of values it is your choice to pick
the first or second of the middle numbers

is this school work? If you are entering integers sort() will not work properly. That is a lexical sort in ASCII order, not numeric order. To properly sort numbers use: <=>

@sorted = sort {$a <=> $b} @unsorted;