Note that a C' prefix is a horrible idea:

Well the problem is the same for double colon syntax.

I would need relative package paths but can't achieve them easily.

I couldn't even make something like $arr[__PACKAGE__::C::Index] or $arr[__PACKAGE__.'::C::Index'] expand correctly at compile time.

So BUK has a point to use underscore prefixes!

Anyway my intention to use a package for the array indices was to avoid polluting the package namespace with constants which should only be associated and encapsulated to special datastructures.

I'm not completely understanding the code you're showing, looks like your globally importing the constants into the package and facilitating the initialization of the index-values. (As a side node there is constant::lexical2 on CPAN)

Thanx!

Cheers Rolf

UPDATE: did clarification of two phrases.


In reply to Re^2: Named array indices (packages) by LanX
in thread Named array indices by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.