I am a perl newbie.
I am trying to write a simple preprocessor to strip out some lines from a file. Basically if "somestring" is found, it should delete all content from that point until ";" is found.
It does this ok right now if it is only on the same line. Can anyone please help?
Thanks in advance, and please forgive my ignorance.
I am trying to write a simple preprocessor to strip out some lines from a file. Basically if "somestring" is found, it should delete all content from that point until ";" is found.
It does this ok right now if it is only on the same line. Can anyone please help?
Code:
open(INPUT, "test.in") or die $!;
my $contents = do { local $/; <INPUT> };
$contents =~ s/.*somestring.*;//mg;
print $contents;
close (INPUT);
Thanks in advance, and please forgive my ignorance.