in reply to Reading constant

here are the docs, pay special attention to the section named "List constants". Constants are always scalars so you need to provide an array reference as the value. But qw// returns a list and not an array reference. Update: erm nope. Let me check this.

update2 Ah. I see. Your problem is that qw// makes a list of strings, and the string "ABC" is not the same as the value of the constant named "ABC".

If you want to use a constant as an element in a list, don't use qw, use (), and make sure the constant is defined before you use it

use constant ABC => qw/wet ear rtf/; use constant HEAD => (ABC,"DEF","GHI"); print $_ for HEAD;

Replies are listed 'Best First'.
Re^2: Reading constant
by kulls (Hermit) on Dec 09, 2006 at 13:30 UTC
    Hi,
    Thanks for your reply.I understood the problem.
    - kulls