This should be able to work:
#!/usr/bin/bash exec strace -e trace=REPLACE_ME -o /tmp/strace.$$ \ perl -x "$0" "$@" #!/usr/bin/perl # (normal Perl script)
However, when running on a server that has SELinux enabled, it's possible its ruleset will prohibit strace from working. You will find additional information via tail -n100 /var/log/messages | grep -i ptrace, including information on how to temporarily disable this restriction for a particular script (I think?).