----- Original Message ----- From: "Sergey Cherniyenko" > > S> use warnings > S> use constant VALUE => foo(); > S> print VALUE, "\n"; # print 42 > S> sub foo {return 42} > > S> But all that produces is (as is to be expected): > S> Undefined subroutine &main::foo called at try.pl line 2. > S> BEGIN failed--compilation aborted at try.pl line 2. > > Just place foo() declaration before constant declaration. Works fine for > me. >
Works for me, too .... thanks Sergey. I'm a little puzzled, however. In 'perldoc constant' I see: -- quote -- As with all "use" directives, defining a constant happens at compile time. -- end quote -- It seems to me, therefore, that foo() is being called and evaluated at compile-time. Is that so ? I thought foo() would be unreachable until runtime. Cheers, Rob _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs