They are, and you can, but Data::Dumper seems to be having problems deparsing subroutines created by use constant back into source code. You have to set $Data::Dumper::Deparse to a true value to make Data::Dumper use B::Deparse, but even then the constant is nowhere to be seen, despite the subroutine itself works:I was under the impression that constants are really subs that I could take the reference ofsub { "DUMMY" };
use strict; use warnings; use Data::Dumper; local $Data::Dumper::Deparse = 1; use constant INVALID_DATA => ( q{invalid}, 0 ); use constant ADD_DATA => ( q{add}, 1 ); use constant REMOVE_DATA => ( q{remove}, 2 ); use constant MODES => ( \&ADD_DATA, \&REMOVE_DATA ); print Dumper [ MODES ]; print Dumper [ (MODES)[0]() ];
In reply to Re: Multi-dimensional constants
by Anonymous Monk
in thread Multi-dimensional constants
by Ionic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |