in reply to Students Rank calculation for the below perl script

You declare @marks outside of the while loop and then
push(@marks,$3,$4,$5);
inside the loop. @marks is accumulating the marks for all the students. If that is not what you want move the declaration inside the while loop.
while(my $line=<FILE>){ my @marks; ... }