If you are doing anything like this to a large file consider using a database or tieed file.use strict; my $stdInfo="stdInfo"; print " Enter the number of student that you want to delete\n"; my $std = <STDIN>; chomp $std; #open file and read it into an array... open(FILE, "$stdInfo") || die "couldn't open $stdInfo\n"; my @filedata = <FILE>; 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);
In reply to Re: updating Input file
by waswas-fng
in thread updating Input file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |