in reply to Re: Problem with constant pragma and some hash definitions
in thread Problem with constant pragma and some hash definitions

Another way around this is
my %generator_lookup = ( E_MESYSTEM , 'G_SYSTEM_SYSTEM_ID', E_MEENTITY , 'G_ENTITY_ENTITY_ID', );
The comma operator does not quote the lefthand side like => does. Just as a side note, I did notice that vim correctly color coded the source when I cut and pasted your code. The constants where correctly colored as quoted strings when I pasted them in, when I changed the => to , the E_MESYSTEM and E_MEENTITY changed color indicating they where not quoted strings. That is very useful.

--

flounder

Replies are listed 'Best First'.
Re: Re: Re: Problem with constant pragma and some hash definitions
by sauoq (Abbot) on Jul 18, 2003 at 19:27 UTC

    Avoiding the fat comma doesn't help in the case of hash lookups though. And, since you have to write it as $generator_lookup{&E_MESYSTEM} when looking it up, you might as well put the ampersand in when initializing it too, even if only for the sake of consistency.

    -sauoq
    "My two cents aren't worth a dime.";