in reply to How can I delete characters between < and > in Perl?

use File::Slurp; my $text = read_file( 'filename' ) ; $text =~ s!<[^>]+>!!g;

Replies are listed 'Best First'.
Re^2: How can I delete characters between < and > in Perl?
by Anonymous Monk on Apr 18, 2009 at 14:04 UTC
    needs to be non-greedy $text =~ s!<[^>]+?>!!g;

      What's the difference? The character class ([^>]) is never going to accidentally slurp up closing hoinkies anyway.

      That is incorrect. That's part of the reason for using negated match classes. It cannot over-match.