in reply to Re^2: How to conditionally use CGI::Carp?
in thread How to conditionally use CGI::Carp?

OK, now waitaminute.... I've got an update, and hence a modification to my previous reply to this. That is, I said that my %ENV had nothing in it. I was wrong--it DOES. The reason I was mistaken is because I was trying to be tricky. Follow me on this because it gets circuitous--thus, interesting. I used the following code:

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?"..