in reply to Re^11: replicating the command 'unset LIBPATH' in perl
in thread replicating the command 'unset LIBPATH' in perl

I was referring to Anonymous Monk and JavaFan's BEGIN code.

But the code starts with first two lines

#!/usr/bin/perl -- BEGIN {

I thought it didn't matter where you put the BEGIN statement since it executed first at compile time? Obviously not!

Who told you that? Which line do you think gets executed first?

$ cat junk12.pl warn "hello"; BEGIN { warn "hello "; } warn "hello"; BEGIN { warn "hello "; } warn "hello";

See also Execution order of END/CHECK vs BEGIN/INIT

I get the uninitialised error message,

Those are called warnings (see perllexwarn), and in order to get warnings, you have to specifically turn them on, which the code I posted did not do (you should do that in your code, ...).

I could live without being able to step through the code in debug mode, although again, I don't understand why the inclusion of Anonymous Monks BEGIN code seems to disable debug mode.

Wait, what? perldoc -f exec