









|
[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
[NMLUG] An antispam script
Ed Brown wrote:
> I don't have a need to try this, but enjoyed just reading through it.
> It's a nice example of perl scripting, and I'm saving it for future
> reference.
Before this script, I hadn't written any perl programs for about 5
years. Nearly all of my programming is in ANSI Common Lisp. Perl5 has
some nice new features compared to Perl4. I think that Perl5's
closures are especially useful, though this simple script does not use
them.
> Somthing I'm still not real clear about: the use of 'my' versus the use
> of 'our' at the top-level or scope of a given package, where only one
> package is involved. Is there a reason why you sometimes use one or the
> other?
Perl's 'our' statement is relatively new. It defines a package global.
I use 'our' in the program so that the values of such variables can be
overridden in the configuration file. 'my', on the other handle,
defines a variable with file lexical scope -- it's binding is not
available outside of the file scope. Previous to 'our', Perl programs
would use 'my' along with 'use vars' for a similar, but not identical,
result.
More information about Perl5 scoping can be found via Google.
http://perlmonks.thepen.com/66677.html is a reasonable start.
Best,
Kevin
|
|