[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Constants as array refs



Jeff Boes wrote:
> 
>   use constant CARRAY => [1, 2, 3, 4];
> 
> What is the syntax to dereference this constant directly into the list of a
> 'foreach' loop?

It is (very unfortunately) necessary to remember that constants
defined with "use constant" are actually subroutines.

	for ( @{ &CARRAY } ) { ...

hth,
John Porter



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe