In article <20000303093207.A11207@pimlott.ne.mediaone.net>, Andrew Pimlott <andrew@pimlott.ne.mediaone.net> wrote: >> I guess that's what Perl gets for blurring C's iron-clad distinction >> between statement and expression. > >Even if such blurring exists (for which I see no evidence, though >all I read is perlsyn, not the C standard), it has nothing to do >with the unexpected output. The following (which I think you'll >agree exhibits no blurring) produces the same output: > >#!perl -wl >@array = (1,0,0,1,0); >print scalar grep { if (!$_) { 1 } } @array; >print scalar grep { unless ($_) { 1 } } @array; >__END__ > >The key is Perl's implicit return value, which has no analog in C. That is the blurring to which I referred. In C a "statement" has no return value and may not be used where an expression is expected. In Perl, a "statement" always has a return value (even do {}) and may sometimes (but not always) be used as an expression. ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe