Re: perlfaq4: How can I remove duplicate elements from a list or array?
[email protected] (_brian_d_foy) Fri, 01 Apr 2005 13:38:06 -0600
| Newsgroups | perl.perlfaq.workers,perl.documentation |
|---|---|
| Message-ID | <010420051338063406%[email protected]> |
In article <[email protected]>, Keith Ivey <[email protected]> wrote: > _brian_d_foy wrote: > > The first time the loop > > sees an element, that element has no key in C<%Seen>. > Why the capital "S"? None of the other variables are > capitalized, and it's not standard Perl practice. Honestly, I use a capital S because I've only ever seen that variable name in that context with a capital S. However, you'll find in perlstyle: You may find it helpful to use letter case to indicate the scope or nature of a variable. That's what happening here. In general, for variables that I use only inside a contruct (like the foreach) but declare outside the construct, I use an initial capital letter. Even though in these examples it's a lexical variable, it has a scope beyond its use, so I name it like I would a package variable. -- brian d foy, [email protected]