print "" . $CellObject->Value . "" if ($CellObject); I would do: print ($CellObject ? ("" . $CellObject->Value . "") :" ");