Respectfully, I disagree with this:
Peter Scott wrote:
> They're bad mainly because they suggest that the author doesn't understand
> Perl well. So if I see code like that, my spidey sense starts tingling and
> I wonder how good the code is. Why would someone type unnecessary quotes
> unless they were confusing Perl with the Bourne shell, in which case they
> may well have made some real mistakes?
A lot of the programming that I do requires that I do stuff like:
print "The name of the user is $username, and he is $age years old.\n";
Sure, there are many ways to print this out:
print "The name of the user is ".$username.", and he is ".$age." years old.\n";
etc. etc., but who's to say that one method is better than the other? When you
say "I wonder how good the code is.", who determines what is "good code" and
what is "bad code"? Is "good code" referring to readability, efficiency,
elegance, or something else entirely?
Maybe doing print "$username"; provides visual continuity that extends
throughout the function, or something like that.
I think I know what good code and bad code looks like because I've been
programming for years, although just 1 year in Perl. But I also think that my
idea of what good code alooks like and your idea of good code looks like are
probably somewhat different.
On the flip side of the coin, I taught C and C++ for a number of years, and
tried repeatedly to beat into my students' heads the idea of good code. Which
was my way, of course! :)
I hope I'm not coming across as attacking you, that's _far_ from what I'm trying
to do here, but just pointing out a slightly different perspective. I hope that
if I'm missing the boat you'll respond. And thank you for mentioning that you've
written a book (Perl Debugged, correct?); you've piqued my curiousity. This list
is great; I'm learning a lot. Thanks!
Pete