[Wellington-pm] Strange (for me) notation

Kent Fredric kentfredric at gmail.com
Wed Jul 22 03:00:01 PDT 2009


On Wed, Jul 22, 2009 at 11:23 AM, Grant McLean <grant at mclean.net.nz> wrote:

> Hi Chris!
>
> It's been so quiet here without you :-)
>
> On Wed, 2009-07-22 at 11:10 +1200, Chris Eade wrote:
> > ... this particular piece of code has me really stumped. It looks
> > like this:
> >
> >   use constant LATEST_D_ACROSS_PRODUCTS => 'P';
> >   <snip>
> >   $ib->{reg}->{@{[LATEST_D_ACROSS_PRODUCTS]}} = $ed;
> >   $ib->{prodNo}->{@{[LATEST_D_ACROSS_PRODUCTS]}} .= "$product_no,";
>
>
Yet Another Plausible Way To Do It


use Readonly;
Readonly my $LATEST_D_ACROSS_PRODUCTS => 'P';
$ib->{reg}->{$LATEST_D_ACROSS_PRODUCTS} = $ed;
$ib->{prodNo}->{$LATEST_D_ACROSS_PRODUCTS} .= "$product_no,";


Biggest advantage of doing it this way is its less surprising.
You don't get all the fun things involved with constant folding, but on the
bright side, you don't get all the fun things involved with constant folding
:)

And Optimality, meh, worry about that when your code is demonstratively too
slow :)



Kent

perl -e  "print substr( \"edrgmaM  SPA NOcomil.ic\\@tfrken\", \$_ * 3, 3 )
for ( 9,8,0,7,1,6,5,4,3,2 );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/wellington-pm/attachments/20090722/424fd458/attachment.html>


More information about the Wellington-pm mailing list