![]() |
|
No such thing as a small change | |
PerlMonks |
Re: constant and eval (are they enemies?)by Juerd (Abbot) |
on May 22, 2002 at 19:53 UTC ( #168567=note: print w/replies, xml ) | Need Help?? |
eval returns whatever the block of code returns. A block of code returns the return value of the last evaluated statement. use is a compile-time keyword, and at runtime, nothing happens in your evaled code, so it returns undef. Undef is false, so $@ is warned. But because nothing went wrong, $@ is empty, and warn warns "something's wrong". Fix it like this:
Or like this (make it return true): The first solution is better, imho.
In Section
Seekers of Perl Wisdom
|
|