eval { print $filehandle ....... } if ($@) { error hnadling }