> On Mon, Jul 27, 2009 at 09:49, Bryan Harris<bryansli...@gmail.com> wrote:
> snip
>>> Yes because $_ is a special global variable.  This effect is called
>>> "action at a distance" which is why it is better to use named lexically
>>> scoped variables instead of $_.
>> 
>> I have the Perl Bookshelf on CD (and perldoc, obviously) -- where can I read
>> more about this?
> snip
> 
> Take a look at [Perl Best Practices][1] by Damian Conway (chapter 5
> covers variable use), but be warned, not all of the advice in PBP is
> still considered correct.  Another good resource is [Perl::Critic][2],
> but, again, you do not have to follow everything it tells you. You
> will also want to read about the [my][3], [our][4], and [local][5]
> functions and anywhere in the docs where the talk about lexical (my)
> or dynamic (our & local) scope, including, but not limited to the
> [Private Variables via my()][6] and [Temporary Values via local()][7]
> sections of perlsub.

Wow, I wish I'd read this email before sending that last one.  The
perldoc.perl.org site has gotten a tremendous upgrade, it's beautiful now.
It also explains the whole local($_) thing, though it doesn't really explain
"why", just "that".



> snip
>> Why is perl on OS X still at 5.8.8?  It's free, right?  why wouldn't Apple
>> include the latest one?  (I know this isn't an Apple list, just wondering if
>> anyone knows.)
> snip
> 
> Because Apple is being conservative (and rightly so, 5.10.0 has a lot
> of bugs).  The next release (Snow Leopard) will have 5.10, and you can
> always compile it yourself or use [ActiveState's version][8].  In
> fact, there are those in the community who claim you should never
> trust a vendor supplied version of Perl and should always compile your
> own copy.

That feels like a really bad idea for me, though, since I'm writing scripts
where my primary goal is portability.  Having my own compiled copy seems
like a recipe for disaster if I need others to be able to run it just like I
do.



> [1] : http://oreilly.com/catalog/9780596001735/
> [2] : http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic.pm
> [3] : http://perldoc.perl.org/functions/my.html
> [4] : http://perldoc.perl.org/functions/our.html
> [5] : http://perldoc.perl.org/functions/local.html
> [6] : http://perldoc.perl.org/perlsub.html#Private-Variables-via-my%28%29
> [7] : http://perldoc.perl.org/perlsub.html#Temporary-Values-via-local()
> [8] : http://www.activestate.com/activeperl/

Terrific list, thanks for the links.  =)

- Bryan




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to