in reply to delete a line from a file
However you should have noticed on the preview page that it didn't, weren't you curious?if ( -f $working_file ) { open WORKINGFILE, "<$working_file" or die $!; while (<WORKINGFILE>) { $line = $_; #@storelist - I am getting this thru a sql statement foreach $temp (@storelist) { chomp $temp; ($x,$store,$distri,$end_date)=split(';',$temp); chomp $store,$distri,$end_date; # print LOG "The store in the lookup is $store and the distributo +r is $distri\n"; if ( "$store" ne "" && "$end_date" eq "" ) { if ( substr($_,0,4) =~ "$store" ) { open NEWFILE,">>$temp_dir$next_file" or warn $!; print NEWFILE $_; # delete $_ from $working_file ?????????? HOW ???? } } }
You need to write the lines you wish to keep to a temporary file and rename it on completion or create an array tied to the file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: delete a line from a file
by vbynagari (Initiate) on Jan 28, 2010 at 16:53 UTC | |
by Utilitarian (Vicar) on Jan 28, 2010 at 17:04 UTC |