In article <mac-perl.199810300445.UAA07980@shell13.ba.best.com>, Xah Lee <xah@best.com> wrote: >The "predicate ? expression1: expression2" construct in Perl is not a >mere syntax sugar. It differs from "if then else" because the former >is an expression and the latter is not. More specifically, the former >returns a value. In practice, this means one can do: > >my $var = (predicate ? expr1: expr2); > >but not > >my $var = if (predicate) {expr1} else {expr2}; Actually, you can: $result = do { if ($predicate) { "TRUE" } else { "FALSE" } }; >For large programs, readibility depends on one's knowledge of >programing more than choice of syntax and code formating. I disagree. Compare the readibility of the above to a reformatted snippet of Chris' code from earlier in the thread: foreach(@ARGV){/.*:(.*)$/;$name=$1;$read=-r$_?"YES":"NO";$write=-w_?"YES":"NO";$exec=-x_?"YES":"NO";$kind=-d_?"FLDR":"FILE";$size=-s_;$lastmodified=-M_;write;} Simply visually lining up parallel constructs can speak volumes about what you are trying to do. (It's an odd sensation, agreeing with Tom Christianson. Have folks seen his PerlStyle pages, at http://language.perl.com/style/slide-index.html ) -- __________________________________________________________________________ Jeff Clites Online Editor http://www.MacTech.com/ online@MacTech.com MacTech Magazine __________________________________________________________________________ ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch