http://www.perlmonks.org?node_id=1103757


in reply to Re^2: Problem merging thousands of PDFs with PDF::API2: 'Deep recursion on subroutine "PDF::API2::Basic::PDF::Objind::release"'
in thread [SOLVED] Problem merging thousands of PDFs with PDF::API2: 'Deep recursion on subroutine "PDF::API2::Basic::PDF::Objind::release"'

If you don't need any PDF::API2 specific features, then perhaps you can try something else? For example CAM::PDF. It comes with appendpdf.pl script which does something similar to what you need.