leocharre has asked for the wisdom of the Perl Monks concerning the following question:
I am scratching my head a little...
Why is it that in my code the following, throws global symbol errors ...
my $META_HIDDEN = 1; sub META_HIDDEN : lvalue { $META_HIDDEN } my $META_EXT = 'meta'; sub META_EXT : lvalue { $META_EXT } my $to = $self->abs_loc . ( META_HIDDEN ? "/.$newname." : "/$newname." ) . META_EXT;
But if I change to the following ...everything is fine!
my $META_HIDDEN = 1; sub META_HIDDEN : lvalue { $META_HIDDEN } my $META_EXT = 'meta'; sub META_EXT : lvalue { $META_EXT } my $to; if (META_HIDDEN){ $to = $self->abs_loc . "/.$newname.". META_EXT; } else { $to = $self->abs_loc . "/$newname.". META_EXT; }
Am I missing something really dumb?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: funky error using lvalue subs in ternary assignment?
by ikegami (Patriarch) on Mar 27, 2007 at 19:43 UTC | |
|
Re: funky error using lvalue subs in ternary assignment? (())
by tye (Sage) on Mar 27, 2007 at 19:51 UTC | |
|
Re: funky error using lvalue subs in ternary assignment?
by Zaxo (Archbishop) on Mar 28, 2007 at 05:34 UTC | |
|
Re: funky error using lvalue subs in ternary assignment?
by ferreira (Chaplain) on Mar 27, 2007 at 20:03 UTC |