use strict; my $stdInfo="stdInfo"; print " Enter the number of student that you want to delete\n"; my $std = ; chomp $std; #open file and read it into an array... open(FILE, "$stdInfo") || die "couldn't open $stdInfo\n"; my @filedata = ; close (FILE); #open file for writing... open(FILE, ">$stdInfo") || die "couldn't open $stdInfo\n"; foreach my $line (@filedata) { print FILE $line unless ($line =~ /^$std/); } close (FILE);