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