[Wellington-pm] Strange (for me) notation

Chris Eade chris.eade at gmail.com
Tue Jul 21 20:52:08 PDT 2009


Thanks for the info everyone :-)

On Wed, Jul 22, 2009 at 3:05 PM, Olly Betts<olly at survex.com> wrote:
> On Wed, Jul 22, 2009 at 10:19:55AM +1000, Daniel Pittman wrote:
>> ] perl -MO=Deparse example.pl
>> sub LATEST_D_ACROSS_PRODUCTS () { 'P' }
>> use constant ('LATEST_D_ACROSS_PRODUCTS', 'P');
>> $$ib{'reg'}{@{['P'];}} = $ed;
>> $$ib{'reg'}{'P'} = $ed;
>> $$ib{'reg'}{&LATEST_D_ACROSS_PRODUCTS} = $ed;
>> $$ib{'reg'}{'LATEST_D_ACROSS_PRODUCTS'} = $ed;
>
> Neat, thanks for the tip.
>
> Note that this also works as intended, and the constant gets substituted:
>
> $ib->{reg}->{(LATEST_D_ACROSS_PRODUCTS)} = $ed;
>
> This seems clearer too (constants being subroutines feels like an
> implementation detail to me).
>
> Cheers,
>    Olly
> _______________________________________________
> Wellington-pm mailing list
> Wellington-pm at pm.org
> http://mail.pm.org/mailman/listinfo/wellington-pm
>


More information about the Wellington-pm mailing list