perlquestion
FoxtrotUniform
<p>So I'm writing some code to perfect-shuffle two lists,
and I want it to complain when it doesn't get lists of
equal length. Which style is preferred?
<code>
# .. or warn is homomorphic to the .. or die idiom, and is
# phrased like an assert.
@foo == @bar
or warn "perfect_shuffle: lists must have equal length\n";
# explicit if makes adding cleanup easier, and is phrased
# like an error check.
if(@foo != @bar) {
warn "perfect_shuffle: lists must have equal length\n":
}
</code>
Opinions?
</p>
<p><b>Edit:</b> <code>s/scalar \@/\@/g;</code>; thanks
[adrianh]!</p>
<div class="pmsig"><div class="pmsig-95145">
<p><tt>-- <br>
<font color="#000000">F</font>
<font color="#220000">o</font>
<font color="#550000">x</font>
<font color="#880000">t</font>
<font color="#aa0000">r</font>
<font color="#dd0000">o</font>
<font color="#ff0000">t</font>
<font color="#ff0000">U</font>
<font color="#dd0000">n</font>
<font color="#aa0000">i</font>
<font color="#880000">f</font>
<font color="#550000">o</font>
<font color="#220000">r</font>
<font color="#000000">m</font><br>
Found a typo in this node? /msg me<br>
% man 3 strfry
</tt></p>
</div></div>