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:
while this fails to compile with the error message "Global symbol "$epoch" requires explicit package name at <path and module> line 95."my $epoch; $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?my $epoch=stat($self->{ABS_FILENAME})->mtime&&do{ $self->{CONFIG_EPOCH}=$epoch; };
This is with Perl 5.6.1 from Active State.
Everything went worng, just as foreseen.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: my $variable with &&do{} doesn't compile
by Skeeve (Parson) on May 26, 2003 at 09:14 UTC | |
Re: my $variable with &&do{} doesn't compile
by Tanalis (Curate) on May 26, 2003 at 09:06 UTC | |
by Skeeve (Parson) on May 26, 2003 at 09:15 UTC | |
by Tanalis (Curate) on May 26, 2003 at 09:16 UTC | |
Re: my $variable with &&do{} doesn't compile
by broquaint (Abbot) on May 26, 2003 at 12:39 UTC | |
Re: my $variable with &&do{} doesn't compile
by Aristotle (Chancellor) on May 29, 2003 at 22:08 UTC |
Back to
Seekers of Perl Wisdom