Michael ODonnell writes:

> Yes.  Right.  Sheesh, thanks a bunch, guys but I get the CompSci101
> stuff (I've *written* compilers and kernels) I just ask questions
> like these in public to keep discussion flowing, and I remarked
> about that blindly-cranking-the-counter-til-it-wraps situation
> because it was, um, remarkable (to me) how b0rken/clumsy it seems.

This reminds me of people who are trying to keep all of the unique
lines in a file, and keep them in order too, who write:

  perl -ne 'print if (!$seen{$_}++)' somefile.txt

I occasionally try to point out that this code is in fact incorrect.
Here is one way to make the code correct:

  perl -ne 'print if (!defined($seen{$_})); $seen{$_}=1;' somefile.txt


Sure, the first method "looks cooler" but I come from the "it must be
correct" camp.


Regards,

--kevin
-- 
GnuPG ID: B280F24E                Meet me by the knuckles
alumni.unh.edu!kdc                of the skinny-bone tree.
http://kdc-blog.blogspot.com/     -- Tom Waits
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to