I also just read local is better than 'my' for file handles

Yes this is true for advanced scenarios. However using anonymous filehandles available in 5.6 and later (or is it earlier as well?) avoids almost all of the scenarios where localising a filehandle is necessary. (Well, an exception being when dealing with older code that still uses dynamic filehandles instead of anonymous ones)

open my $private_filehandle,"<",$0 or die "Weird! failed to open mysel +f ($0) : $!";

Local is only really needed when localizing special filehandles like STDOUT and the like, or when localizing special variables like @ARGV and $_ and %ENV or whatever. (Actually this is not strictly true, sometimes using dynamic scoping is a powerful way to configure a module, for instance Data::Dumper, but of course that was written by a real guru, and the justifications are beyond the scope of your skills and this reply.) The note you post is most likely from an earlier version of perl, or hasnt been updated since an earlier version of perl.

--- demerphq
my friends call me, usually because I'm late....


In reply to Re: Re: Re^4: Many strings make one variable? by demerphq
in thread Many strings make one variable? by heezy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.