As far as $_, I think that the problem of the many uses can be overcome by simply doing
{
local $_;
# stuff...
}
.
I haven't seen this do anything too weird, and it provides a good way to overwrite $_ temporarily. It sort of reminds me of elisp's (save-excursion ...) Anyway, here's my answers to the questionnaire -- favorites are first.
(Least) Favorite Perl Instruction | local; reset | See above. Why reset? Too dangerous, especially when you've got tons of single-char vars. |
(Least) Favorite Looping Mechanism | {}; for | Naked blocks give you more flexibility. for just seems useless to me. |
(Least) Favorite Module | Data::Dumper; | Dump those objects! No least favorite -- I sort of like them all. |
(Least) Favorite Special Var | $_; $] | $_ is so useful. $] is not. |
Favorite Var Type | typeglob | Very obfuscatable. |
(Least) Favorite Command Line Switch | -e; -U | -e allows me to do one-liners. -U does unsafe things. |
Favorite Pragma | use strict; no strict "refs"; | Good for bugcatching, except when I want to use symbolic references. |
Favorite Regexp {Modifier,Metachar} | i; \Q | Yes to i! Too much work to manually decapitalize all the time. \Q useful for when arbitrary data comes in which you need to match. |
Favorite Descriptive Var Name | %z | Not very descriptive, but I like it nonetheless. |
Favorite HERE doc delimiter | print; | Or some other command... |
Favorite Filehandle | FOO | Should be obvious why... |
-
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.
|