To avoid common errors use the compiler flags: use strict; use warnings; with a history lesson.
use diagnostics; to get even longer explanation.
Some of the common warnings and errors you can
catch by using strict and warnings.
use diagnostics; or use splain.