[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-AnyPerl] substituting on multiple lines



hi
i' m relatively new to perl and have a basic question.
i´m trying to write a script to strip html produced by the microsoft
word-editor.
please look at the  code below.
thanks
allan

first here is some of my somefile.html
__________

<html>
<style>
a hell of a lot
of useless word-code
that differs from time to time
</style>
</html>
________

and here is my .pl
___________

#!/pack/collect/bin/perl

open(MAINLATE, "somefile.html");
@whatever = <MAINLATE>;
close(MAINLATE);

foreach $line (@whatever)

     {
      $line =~ s/<\/?style>//ig;
      $line =~ s/^[\s|\t]*\n//ig;
     }

 print @whatever
______________

this should replace the two html <style> tags with nothing and remove
blank lines - no problem.
what if i want to replace everything in between as well?
so i end up with a somefile.html that look like:

<html>
</html>


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org