in reply to Re^3: Fastest way to test membership in a constant set
in thread Fastest way to test membership in a constant set
Instead, it's just syntax sugar to declare multiple constants with one use constant statement.use constant { SEC => 0, MIN => 1, HOUR => 2, MDAY => 3, MON => 4, YEAR => 5, WDAY => 6, YDAY => 7, ISDST => 8, };
I searched the doc on constant, and didn't see a good example, though
Dereferencing constant references incorrectly (such as using an array subscript on a constant hash reference, or vice versa) will be trapped at compile time.implies that a hash constant can be created.
Here's how it's done:
and from the debuggeruse constant Books_I_Own => { "The Wit and Wisdom of Mark Twain" => 1, "Attack of the Deranged Mutant Killer Monster Snow Goons" => 1, "Unix Power Tools" => 1, }
...so it is possible to have a constant set, if a hash is a set.DB<2> x Books_I_Own 0 HASH(0x1c831b8) 'Attack of the Deranged Mutant Killer Monster Snow Goons' => 1 'The Wit and Wisdom of Mark Twain' => 1 'Unix Power Tools' => 1
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Fastest way to test membership in a constant set
by BrowserUk (Patriarch) on Aug 10, 2007 at 15:48 UTC |