Dump the "&" in front of subroutine calls.
- Using & disables a function's prototype.
- If you don't pass any parameters to a function, but call it using &, it will receive your current @_ as its parameters. This can lead to very hard to spot errors.
Is it just that I should use the hash in my code as opposed to assigning the hash values to a variable and then using the variable instead?
Indeed. Why assign to a hash first when you're going to put it into a variable afterwards? Using a hash also is usually cleaner, since it provides an own little name space for the variables in question; it keeps together what belongs together, and keeps them from littering the global namespace.
What exactly does the $|=1 do?
It disables buffering for the currently selected filehandle (which would usually be STDOUT). See perlvar.
Makeshifts last the longest.
-
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.
|