Gossamer Forum
Home : General : Perl Programming :

Deleting lines s/^.[^\!].*\s//g

Quote Reply
Deleting lines s/^.[^\!].*\s//g
I'm trying to delete all lines except those starting with <!--\d+-->.

Code:
foreach $reline (@rehtml) {
if ($reline=~ s/^.[^\!].*\s//g) {
}
if ($reline=~ s/^\s//g) {
}
}
Problems:
1) The not [^\!] only seems to work with one character [^\!--\d+--] doesn't gain me anything, in other words it will keep all comment lines.
2) I need a blank last line or it leaves the last line (could have something to do with the hypermart banner).


[This message has been edited by Dave (edited September 30, 1999).]