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

RE: [FWP] Constants as array refs



> From: Bernie Cosell [mailto:bernie@fantasyfarm.com]
> Sent: Thursday, March 23, 2000 13:42
> To: fwp@technofile.org
> Subject: Re: [FWP] Constants as array refs
>
>
> On 23 Mar 2000, at 15:39, Ronald J Kimball wrote:
>
> > > It is (very unfortunately) necessary to remember that constants
> > > defined with "use constant" are actually subroutines.
> > >
> > > 	for ( @{ &CARRAY } ) { ...
> >
> > Using the & syntax prevents Perl from optimizing calls to constant
> > subroutines.
>
> I don't understand...  I didn't think there was a semantic difference
> between:
>    a()
> and
>    &a
> but apparently there is..  ????

perldoc perlsub

    a() passes an empty argument array @_ to sub a

    &a  passes the arguments of the subroutine in which &a is called, if
any.

--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com




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