print " Enter the number of student that you want to add\n"; my $std = ; chomp $std; open(FILE, "$stdInfo") || die "couldn't open $stdInfo for reading"; my @in=; close(FILE); open (FILE, ">$stdInfo") ||die "couldn't open $stdInfo for writing"; for (@in) { print FILE unless ( $_ =~ /^\Q$std\E\b/ ); print $std; } close(FILE);