On Wed, Aug 13, 2003 at 12:55:16PM -0400, Chris Devers wrote:
> On Wed, 13 Aug 2003, Kenneth Graves wrote:
>
> > This should work:
> >
> > if (length($value) == 0) {
> > $count += 1;
> > }
>
> Is there a reason you're not using a simple
>
> $count++
>
> that I'm not thinking of?
Well, I for one prefer += 1 to ++ because of ++'s confusing magical
properties.
[EMAIL PROTECTED] (0) ~
$ perl -le '$x="b1a"; $x++; print $x'
1
[EMAIL PROTECTED] (0) ~
$ perl -le '$x="bIa"; $x++; print $x'
bIb
[EMAIL PROTECTED] (0) ~
$ perl -le '$x="bIa"; $x += 1; print $x'
1
[EMAIL PROTECTED] (0) ~
$
Unless writing throwaway code, I usually pretend Perl didn't have ++
and -- operators. If I really want the magical string ++, I will
write a big comment explaining its use.
--
John Tobey <[EMAIL PROTECTED]>
\____^-^
/\ /\
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm