Many times when writing code, a beginner will ask the language to perform an operation and receive an unusual result. While possible, it is highly unlikely that a beginner will find a bug in perl, JavaScript, etc. Programmers must be humble. The fault ususally lies with us.

Chances are we are asking the programming language to do what we mean instead of telling it what we really want to do. Some languages have logic builin that will try to guess when something might go either way, but we shouldn't depend on this.

Here's an example

  1. $time = "10:10:00";
  2. $other_time = "10:10:40";
  3. print $time - $other_time;

No web programming language will return 40 seconds as the answer without extra work.

The programming language does what I want (DWIW), when I was hoping it would do what I mean (DWIM). The next time you don't get a desired result, make certain you are using DWIW.