in reply to Re: How do I read the contents of an HTML file between two BODY tags?
in thread How do I read the contents of an HTML file between two BODY tags?

I realize this thread is long dead, but I just stumbled across it and found it useful. However, that construct would include the body tags in the output. To exclude them, add another expression:
open(HTML,"test.html") || die "cant open file\n"; while(<HTML>){ if(/<body.*?>/i ... /<\/body.*?>/i){ s/\<\/*body.*?>//ig; # Strip body tags from $_ print OUTFILE $_; } } close HTML;
  • Comment on Re^2: How do I read the contents of an HTML file between two BODY tags?
  • Download Code