use strict; use warnings; while ( ) { #if it is in between the lines starting with name #and ending with a line of numbers and spaces #note that the between in inclusive so it includes #those two lines. if ( /^name/ .. /^[\d ]+$/ ) { #don't want the next line of dashes or name line next if ( /name/ or /^---------------------------$/ ); print $_; } } __DATA__ bunch name --------------------------- 23 23 23 23 23 23 23 23 23 of name --------------------------- 25 25 25 25 25 25 25 25 25 other worthless name --------------------------- 28 28 28 28 28 28 28 28 28 unnecessary and annoying noise 1 2 3 4 9 8 name --------------------------- 29 29 29 29 29 29 29 29 29 __END__ 23 23 23 23 23 23 23 23 23 25 25 25 25 25 25 25 25 25 28 28 28 28 28 28 28 28 28 29 29 29 29 29 29 29 29 29