thanks ronald for the quick reply. some of your code is new to me and i cant get it working i guess my complete document should look like below: (this will just print the entire file as it is already) thanks allan ______________________ #!/pack/collect/bin/perl open(MAINLATE, "somefile.html"); { local $/; $text = <MAINLATE>; } $text =~ s!<style>.*</style>!!i; print $text; _____________________ Ronald J Kimball wrote: > On Thu, Jul 06, 2000 at 08:05:13PM +0200, allan juul wrote: > > > #!/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; > > That second one should be: > > $line =~ s/^\s*\n//g; > > or > > $line =~ s/^\s*$//g; > > Inside a character class, | is not a metacharacter, so [\s|\t] matches > whitespace or the | character. \s includes \t, so using both isn't > necessary. > > > } > > > > 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> > > First you want to read the whole file into a scalar: > > { > local $/; > $text = <MAINLATE>; > } > > Then you can replace everything between <STYLE> and </STYLE>: > > $text =~ s!<STYLE>.*</STYLE>!!i; > > And then you can print out the modified string: > > print $text; > > Ronald > > ==== Want to unsubscribe from this list? > ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org