There were many daggers making the Perl Community bleed:
1. Enterprise Development
Java et Al led to a generation of developers working further from the kernel and the shell. Professionalization of the field led to increased specialization, and most developers had less to do with deployment and management of running software.
Tools also got much better, requiring less glue and shifting the glue layer to configs or platform specific languages.
Later on, DevOps came for the SysAdmins, and there's just much less space for Perl in the cloud.
2. The rise of Python
I would put this down mostly to universities. Perl is very expressive by design, in Python there's supposedly only "one right way to do it". Imagine you're a TA grading a hundred code submissions; in Python, everyone probably die it in one of three ways, in Perl the possibilities are endless. Perl is a language for writing, not reading.
3. Cybersecurity became a thing
Again, this goes back to readability and testability. Requirements for security started becoming a thing, and Perl was not designed with that in mind.
4. The Web was lost to Rails, PHP, then SPAs
I'm less clear on the why of that, but Perl just wasn't able to compete against newer web technologies.
You could write good-quality secure code in Perl, but the level of dynamism in the implementation and the fact that there’s only the one main implementation means there’s not much hope of quality static analysis.