On Fri, 6 Dec 2019 at 09:05, ToddAndMargo via perl6-users
<perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
On 2019-12-06 00:01, Tom Blackwood wrote:
> Todd,
>
> AFAIK Perl’s culture is not to use so many constants in actual
> programming. :)
>
> Tom
>
Is there a way to make constants universal inside a module, or
do I have to declare them inside every sub?
On 2019-12-06 01:39, Simon Proctor wrote:
If you define them in the top level of your module then all your subs
have access :
constant FOO = 2;
sub inc-by-foo( $a ) {
$a+FOO;
}
Do you mean
sub inc-by-foo( $a ) is export {
$a+FOO;
}
?
I tried that several years ago and had no joy. I
had to put the constants inside the sub for the sub
to see them. Is this a change?