in reply to updating file

Ooh, I just love the smell of homework.

First thing you need to do is read input lines using <>, not read. As in:

$time = <>; chomp $time;
You should probably do better matching of the specified $time against the values in the .dat file. E.g.
while (<$fh>) { chomp; my( $n, $i, $t ) = split; $found = 1 if $t eq $time; }
But where is $studentNumber coming from?

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.