FoxtrotUniform has asked for the wisdom of the Perl Monks concerning the following question:
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?
Opinions?# .. 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": }
Edit: s/scalar \@/\@/g;; thanks adrianh!
--
F
o
x
t
r
o
t
U
n
i
f
o
r
m
Found a typo in this node? /msg me
% man 3 strfry
Back to
Seekers of Perl Wisdom