Or remove the curly braces as the docs show: -
1 use strict; 2 use constant COLUMNS => qw/ TEST1 TEST2 TEST3 /; 3 4 my @attr = (COLUMNS); 5 print @attr;
which gives: -
% perl test.pl TEST1TEST2TEST3
Your code actually defines two constants COLUMNS and TEST2: -
use strict; use constant { COLUMNS => qw/ TEST1 TEST2 TEST3 /, }; my @attr = (COLUMNS); print @attr; print TEST2
and gives: -
% perl test.pl TEST1TEST3
source share