in reply to Re^2: How to conditionally use CGI::Carp?
in thread How to conditionally use CGI::Carp?
my $ip = $ENV{'REMOTE_ADDR'}; BEGIN { if ( $ip ) { [...] } }
That didn't work, which is no surprise, because the BEGIN block runs before the code runs, so $ip has no value when the BEGIN block runs. But, if that's the case, why does a print statement print? I take up this question in What is the scope of BEGIN? Or... when does it "begin?"..
|
|---|