in reply to Caputre Entire Line Not Just Find

while(<HANDLE>) sets the special variable $_ to the current line on each iteration (and /$find/ is applied on $_ by default. $str =~ /$find/ would apply it on $str). So $header = $_; should do what you need, although a chomp may be required.