my $content = $pdf->getPageContentTree($page); if (! $content) { warn "Couldn't get content for page $page: $CAM::PDF::errstr"; # thanks to Anonymous Monk for pointing out the error variable } else { # process the page };