in reply to Beauty is in the eye of the beholder

And remember, what is beautiful today, may be considered ugly tomorrow. (can anyone remember the fashion styles of the 1970's?) There has recently been the thread started by Tilly on Random thoughts on programming, where a number of monks shared their wisdom on good program design.

If I were implementing such a "have I got that item in my list?" function, I would also include in the code the "key" to where in the list that item is, just in case I will want to do something to that item. Now, if we use a hash, then we get that:

$my_hash{$key_value} = 'Stuff up the value real good';
Otherwise, if I have a function that tells me whether the item is in the list, I would have the return value being a logical false if the item was not found, or the direct key to it if it was found. If you are doing a simple logical test, then returning a defined value is (should be) accepted as "true" (see page 20 - 21 "What is Truth" of the Camel book).

If it wasn't first thing in the morning, I would attempt to hack a bit of code demonstrating this, but I am sure you all know what I mean here. The essence of what I am saying is that a good programmer looks ahead, and allows for the foreseeable future requirements.

Updated: Stupid typo in code fragment fixed. I should finish my coffee before coding.