Part of your question, though you didn't realize is, is how use constant works.
use constant creates a subroutine of no arguments for the constant you want, which returns the desired value. You COULD do the same manually.
sub FOO(?) {10;} sub BAR(?) {20;}
While it does work in expressions, FOO is not recognized as being a subroutine, when you use it in a string. While there are ways to make it be interpolated within a real string, which may or may not work in the fat-arrow string, the more modern solution is to use Readonly instead of <c.constant</c>. Readonly gives you real scalars, arrays, hashes which can't be modified.
use Readonly Readonly my $FOO => 10; Readonly my @GAMES => ( 'tennis', 'crocket', 'crazy eights' ); Readonly my %NUMBERS => ( consonents => [ qw( b c d f g h j k l m n p q r s t v w x z) +], vowels => [ qw( a e i o u y ) ], );
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
In reply to Re: understanding this syntax
by TomDLux
in thread understanding this syntax
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |