for libperl in $(find ${mydir} -name "libperl.so"); do
to:
for libperl in $(find ${mydir}/ -name "libperl.so"); do
and then if 'mydir' happens to be a symbolic link to another directory (e.g. perl being a symbolic link to perl5.blead.20220809_223700.zos) then the LIBPATH will still get set up properly.l
Change:
to:
and then if 'mydir' happens to be a symbolic link to another directory (e.g. perl being a symbolic link to perl5.blead.20220809_223700.zos) then the LIBPATH will still get set up properly.l