You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by David Arnold <da...@northcoast.com> on 2004/07/04 02:53:48 UTC
Declaring constant
All,
I don't believe I've seen this syntax before?
use constant SECRET_LENGTH => 14;
Anyone have any pointers to an explanation of this syntax?
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Declaring constant
Posted by Stas Bekman <st...@stason.org>.
David Arnold wrote:
> All,
>
> I don't believe I've seen this syntax before?
>
> use constant SECRET_LENGTH => 14;
>
> Anyone have any pointers to an explanation of this syntax?
http://perldoc.com/perl5.8.4/pod/perldata.html#List-value-constructors
<QUOTE>
It is often more readable to use the => operator between key/value pairs. The
=> operator is mostly just a more visually distinctive synonym for a comma,
but it also arranges for its left-hand operand to be interpreted as a string
-- if it's a bareword that would be a legal simple identifier (=> doesn't
quote compound identifiers, that contain double colons). This makes it nice
for initializing hashes:
</QUOTE>
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: Declaring constant
Posted by "Charles C. Fu" <pe...@web-i18n.net>.
On Jul 3, 2004, at 17:53, David Arnold wrote:
> use constant SECRET_LENGTH => 14;
>
> Anyone have any pointers to an explanation of this syntax?
Run "man constant".
-ccwf
--
Charles C. Fu
Founder
Web i18n, LLC
www.web-i18n.net
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html