Hello, perl-win32-users,
Wednesday, September 14, 2005, 12:35:45 PM, You wrote:
S> Hi,
S> Basically, I want to be able to write in a perl script:
S> print VALUE, "\n";
S> and have it print out the value returned by a subroutine. Something like
S> (which won't compile):
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.
use warnings;
sub foo {return 42}
use constant VALUE => foo();
print VALUE, "\n"; # print 42
--
Best regards,
Sergey mailto:[EMAIL PROTECTED]
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs