Use length instead of defined.
In reply to Re^2: Assign result of map to scalar variable by hdb in thread Assign result of map to scalar variable by ram31