I have a text file with links like:
<br><li><a href="
http://www.domain.com">text</a
>
<br><li><a href="
http://www.domain1.com">text</
a>
...
<br><li><a href="
http://www.domain1000.com/page.asp">text
</a>
--------------------------
----------
----------
----------
----------
----------
--------
and I use this to delete lines from it but it does not delete the line or lines from the file.
open(FILES, "$link_file") || die "Can't open FILE: $link_file\n";
@files =<FILES>;
close(FILES);
$x=0;
$set=0;
$num=1;
foreach $line (@files) {
$x++;
if($line =~ /$FORM{'url'}/i) {
@tic[$num] = " Deleted: On Line $x" . $line ."<br>" . "-" x 75 ."<br>";
$set++;
$num++;
@files=grep !/$line/, @files;
}
}
$z=0;
open(XFILES, ">$link_file") || die "Can't open FILE: $link_file\n";
flock (XFILES, 2);
for $line (@files) {
print XFILES $line;
$z++;
}
flock (XFILES, 8);
close(XFILES);
Start Free Trial