[LA.pm] little help??

Bob Mathews bobmath at sbcglobal.net
Wed Sep 28 14:07:03 PDT 2005


On Sep 28, 2005, at 10:14 AM, FamiLink Admin wrote:
>         while (<$slog>){     # assigns each line in turn to $_

Oh, one other thing. Best practice dictates that you do a
    local $_;
before assigning to $_, even the implicit assignment in a while loop. 
(This is not needed with a foreach loop, because those do their own 
localization.) That's kind of ugly, though, so if I want my code to be 
pretty I just forgo the implicit $_ and write something like this:
    while (my $line = <$slog>) { ... }

I got an off-list reply that thought I was being a little too hard on 
you. Didn't really mean to be that way, so sorry if it seemed that way. 
Good luck with your perl hacking!

  -bob



More information about the Losangeles-pm mailing list