On Feb 12, 2008 10:19 AM, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote:
snip
> Thank you for the reply.  I'm definitely still in the crawl before you
> can walk stage with perl and hashes.
> Can you help me understand why I would make the the file handle a scalar
> $SUMMARY instead of just SUMMARY. Also, I've always shied away from the
> style of "next if /$servername/;" I interpret this if statement as "if
> $servername matches then do something else next", right?
snip

Bare word files handles (like SUMMARY) are a hold over from earlier
versions of Perl.  The have a few drawbacks: global scope, difficult
to pass between functions, etc.  The new (well, newer, they have been
around since 5.6) lexical file handles (like $SUMMARY) are much easier
to use, have a specific scope, auto close when they are garbage
collected, and can be passed easily between functions.  You may want
to read the docs for open*, IO::Handle** and IO::File*** for more
information.

* http://perldoc.perl.org/functions/open.html
** http://perldoc.perl.org/IO/Handle.html
***http://perldoc.perl.org/IO/File.html

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to