eval '$_=PDF::Core::PDFGetline ($fd,\$offset);'; if ($@) { # deal with error } # ok, so carry on