in reply to Getting perl code to run sgid

Problem solved, and it turned out not to be a perl issue after all:

The script was physically located on a partition mounted nosuid. Copied it to /usr/local/bin (instead of just symlinking) and it now works fine.