It may also happen when the statement before is not complete.
use strict;
sub test;
test()
# some comment
my $x;
perl now complains with following error message:
my "
Global symbol "$x" requires explicit package name
The error is not in the declaration of “my”, but at the missing semicolon (;
) at test()
.