in reply to Re^2: equivalent to Hash::Util for lists / arrays
in thread equivalent to Hash::Util for lists / arrays

The question was so poorly phrased that I was reluctant to reply, and IMHO toolic willently ignored it and chose the second best approach, the "anal tactic" of a "stubborn" reply... ;-)

We can only speculate about the use case, but IIRC it's possible to define readonly lists with the constant pragma and use them with indices like arrays.

UPDATE:

use constant WEEKDAYS => qw( Sunday Monday Tuesday Wednesday Thursday Friday Saturday ); print "Today is ", (WEEKDAYS)[ (localtime)[WDAY] ], ".\n";

and it's also possible to use read-only values for arrays.

Cheers Rolf

Replies are listed 'Best First'.
Re^4: equivalent to Hash::Util for lists / arrays
by ikegami (Patriarch) on Dec 21, 2010 at 17:43 UTC
    constant only makes the direct value a constant. Anything that might be referenced by those scalars are not made constant.