my $GREP_STR = "123"; ## a global var print GREP_FH "My line with 123\n"; ## anywhere in the code print GREP_FH "My line with 456\n";