use strict; use warnings; while () { print $&."\n" while m/<.*?>/g; } __DATA__ Once upon a time there was a CODE RED situation.