in reply to Search and replace everything except html tags

Well, "$_" eq "<(.*)>" will only match if $_ equals that string, i.e. you're not doing a regexp match there. If you don't want to reinvent the wheel, take a look at HTML::Parser. If you do, and you're positive that each line contains exclusively a tag or line of text, you could do something like this to grab just the tags:
use strict; open FILE, "<temp.html"; my @tags = grep /^<.*>$/, <FILE>; print @tags;
If you actually want to separate into tags and text:
use strict; open FILE, "<temp.html"; my (@tags, @text); while (<FILE>) { chomp; if (/^<.*>$/) { push @tags, $_; } else { push @text, $_; } } print "Tags:\n", join "\n", @tags; print "\nText:\n", join "\n", @text;