#!/usr/local/bin/perl -w use strict; use Fcntl ':flock'; my $file = "inputdata.txt"; open(INFILE, $file) or die "File Not Found: $!"; flock(INFILE, LOCK_EX); my @students; while () { push @students, [split / /, $_]; } my %hash; # where's $grades coming from? # $hash{$grades}= $students[0]*0.2 + $student[1]*0.25+$students[2]*0.25 + $student +s[3]*0.3; # flock(INFILE, LOCK_UN); # don't use unlock, it's done automagically by close() close(INFILE);