I suggest you try to reproduce the problem reliably with the shortest program you can.
Run this program with both Perl 5.30.0 and Perl 5.32.0 while (in another terminal session) monitor the open files of the offending process.
When you compare the open files output of running the same program with Perl 5.30.0 vs Perl 5.32.0, hopefully something will jump out at you, probably something unexpected (after all, "Too many open files" is a rare error in my experience, usually indicating something is horribly wrong with the system or I made a boo-boo).
As for how to monitor which/how many files are open by a specific ubuntu linux process, you can google,
as I did just now, finding this stack overflow question.
Monitoring the details of open files on Linux can be tricky and requires root permissions for best results.
The following Linux tools may be useful (examples can be found in the above stack overflow question):
- lsof : fantastic tool for monitoring open files of running processes. Found some examples of using lsof at this blog and CatOnMat by Peteris Krumins (see also lsfd).
- The /proc file system in conjunction with the ps command, e.g. ls /proc/$pid/fd/. Examples can be found in earlier stack overflow link.
- The ulimit command.
- Update: System call tracing (e.g. strace). Run the perl process with system call tracing on (for an example, see linux security cookbook). Needs root permissions (update: not always, see Fletch response below). For best results run the perl process directly via the strace command (strace can also be used to attach to a running process). Comparing the strace output (via diff say) between Perl 5.30.0 and Perl 5.32.0 should give you a clue as to what is going on.
HTH. I'm a bit rusty on all this stuff and don't have a test ubuntu system handy.
Updated: Noted that root permissions are often not required with strace (thanks Fletch). Minor clarifications and improvements to wording.