[Wellington-pm] Strange (for me) notation
Olly Betts
olly at survex.com
Tue Jul 21 20:05:16 PDT 2009
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
More information about the Wellington-pm
mailing list