my $test,$test2; print "$test\n"; ## print nothing if(not defined $test){ my $test = "GOOD"; print "$test\n"} ## print GOOD ( I need to define $test becasue I use $test at second "if" function only ) print "$test\n"; ## print nothing ( It is my purpose to print nothing so I cann't use global function at first "if" function ) if(not defined $test2){ print "$test\n" } # I want to print GOOD. GOOD is defined on first "if" function. but It print nothing becuase I use local function(my)