At 9:36 -0800 11/2/98, Mark Yannuzzi wrote: >4) pg. 187 has an example containing a line that appears to be a shortcut: > >$answer = (MacPerl::Answer('Erase existing file?', 'No', 'OK')) if >($file->sfReplacing()); > >that suggests that the "if" statement is executed first, and if TRUE, the >statement preceding it is executed (bizarre), otherwise, proceed to the >next line. Perhaps you could include a brief discussion of this along >with your other shortcut examples (the ?: construct, etc.). That is "normal" Perl, and I even use it sometimes. unless can be used the same way: print "Numbers work!\n" unless (2 == 3); You can also leave out the () around the test print "Numbers work!\n" unless 2 == 3; (but I usually prefer not to: note that you CAN'T leave out the () in a "normal" if or unless). I agree that a mention in the book of this why this unusual construct works would be desirable. 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. --John -- John Baxter jwblist@olympus.net Port Ludlow, WA, USA Give a man a fish and you feed him for a day. Teach him to fish, and you get rid of him for the weekend. ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch