Perl Syntax
Stewart C. Russell
scruss-rieW9WUcm8FFJ04o6PK0Fg at public.gmane.org
Wed May 25 11:01:18 UTC 2005
Andrew Hammond wrote:
>
> This also looks like another pretty common trick, the zero parameter
> inline function. This is often used to represent constants. Example follows.
>
> sub INT () { 2 }
It's a bit more logical to use the 'constant' pragma:
use constant PI => 4 * atan2(1, 1);
Has the same effect, though.
> If you're learning perl, the best advice I can give you is to start
> every single one of your programs with "use strict;", which will not
> allow you to use barewords.
While I agree about the 'use strict;' (and would always add 'use
warnings;', and 'use diagnostics;' if you're really new to things),
barewords for hash members seem to be allowed when using strict. It does
look a bit cleaner.
Stewart
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list