$GREP_STR = '123'; print STDOUT "Header - always print this\n"; print GREP_FH "My line with 123\n"; ## printed at the terminal print GREP_FH "My line with 456\n"; ## not printed