[Date Prev][Date Next][Thread Prev][Thread Next]
[Search]
[Date Index]
[Thread Index]
[FWP] A Perl curiosity
Someone pointed this out on p5p recently:
#!perl -wl
@array = (1,0,0,1,0);
print scalar grep { 1 if !$_ } @array;
print scalar grep { 1 unless $_ } @array;
Lines 3 and 4 produce different output, for reasons that should be
apparent, given some thought.
I guess that's what Perl gets for blurring C's iron-clad distinction
between statement and expression.
==== Want to unsubscribe from Fun With Perl? Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
==== unsubscribe