Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
I wonder about this also. Annoying to kind of have to convert that in your head when reading older style instruction (Network Programming with Perl by Stein) that use barewords all over the place when the newer guidance is to use lexical filehandles. I think that the short answer is that the bareword is the old way to do it, and now you should use lexical variables because they limit the scope. This seems to confirm:
#!/usr/bin/env perl use strict; use warnings; { open (OUTPUT,"> out.txt") or die; } print OUTPUT "a"; # Works OUTPUT must still be in scope { open (my $new_out, ">","new_out.txt") or die $!; print $new_out "b"; } #print $new_out "c"; #this will not work

In reply to Re: Why don't file handles have sigils? by trippledubs
in thread Why don't file handles have sigils? by 1s44c

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.