At 18.50 -0500 1998.11.02, John W Baxter wrote: >One argument for using the construct is that it puts the important stuff >(what you are doing) up front on the line. [A counter argument is that it >tends to hide the test.] I use it when the line seems to make more sense >that way than with a normal if or unless. The general Perl style seems to be that: what is the most important part, the condition or the statement? Although I generally forego that and just use the STATEMENT if CONDITION syntax when I can; i.e., when it is one statement to one condition. Of course, sometimes I'll even do something like: warn("oops\n"), last if $x == 1; There are two sides to this story. The first is that it is quite hard to grok for those not used to it. What exactly is going on? Well, you have two statements, separated by a comma, that execute only if the condition is satisfied. You could just as easily do more: warn("oops\n"), print("hm\n"), some_sub(1), last if $x == 1; I am much less likely to do this than I am to do the other. It gets exponentially worse the more you add. :) But yes, you should avoid this construct for the most part. But I use it a lot in my own personal code, or code fragments I might share, because coding this way is what makes Perl fun. Remember that like in English, different styles are used for different purposes. In the work I did on the Mozilla project, everything was very straightforward, prototyped, commented, and made to look very similar to the original AppleScript in how it read. In work for the book, we used a style in the beginning that was as easy to read as possible, and toward the end we traded some of that off for brevity's sake. In my work at Peterson's, I use a very basic style, but with a somewhat casual tone. In module work I tend to use more of the arcane and obfuscated constructions, because I have a lot going on so I try to keep the code tight, and no one needs to look at the module so much as the interface anyway. :) In scripts for myself, I use the most impossible syntax possible, just for fun. The key in Perl, as in English, is Remember Your Audience. Like we say on #perl, "You can do whatever you want, as long as I don't have to maintain your code." -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch