http://qs321.pair.com?node_id=260800

Biker has asked for the wisdom of the Perl Monks concerning the following question:

Guess I'm missing something basic here. (Again ;-)

How come that this compiles (and executes) fine:

my $epoch; $epoch=stat($self->{ABS_FILENAME})->mtime&&do{ $self->{CONFIG_EPOCH}=$epoch; };
while this fails to compile with the error message "Global symbol "$epoch" requires explicit package name at <path and module> line 95."
my $epoch=stat($self->{ABS_FILENAME})->mtime&&do{ $self->{CONFIG_EPOCH}=$epoch; };
I see it that $epoch gets unconditionally created with a conditional value (depending on the outcome of stat) and as such must exist. Looks like Perl is not as sure as I am. Why?

This is with Perl 5.6.1 from Active State.


Everything went worng, just as foreseen.