dideod.yang has asked for the wisdom of the Perl Monks concerning the following question:
my $test,$test2; print "$test\n"; ## print nothing if(not defined $test){ my $test = "GOOD"; print "$test\n"} ## print GO +OD ( I need to define $test becasue I use $test at second "if" functi +on 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 us +e local function(my)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: local & global function
by Jenda (Abbot) on Oct 17, 2018 at 11:12 UTC | |
by LanX (Saint) on Oct 17, 2018 at 12:30 UTC | |
|
Re: local & global function
by 1nickt (Canon) on Oct 17, 2018 at 00:22 UTC | |
|
Re: local & global function (scopes)
by LanX (Saint) on Oct 17, 2018 at 00:30 UTC | |
|
Re: local & global function
by morgon (Priest) on Oct 17, 2018 at 00:20 UTC | |
|
Re: local & global function
by BillKSmith (Monsignor) on Oct 17, 2018 at 15:04 UTC |