Well, i'm not so sure this is a dumb thing to do. For one it allows more flexibility than ||, because you can add the word 'defined' to the beginning which is often the best way to handle defaults. Consider
my $value=0;
my $string1=$value || "No value assigned"
my $string2=$value ? $value : "No value assigned"
my $string3=defined $value ? $value : "No value assigned"
Only $string3 will have the correct value.
What did I do as a mistake in my early stages? I underutilized modifiers leading to hard to read code, I had a lot of $var->{key}->{key}->{key}->{key} kind of stuff. Using temporary variables cleaned that up as well as learning that the form $var->{key}{key} is legit.
Yves
--
You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)
-
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.
|