Application.doScript appears, at first glance, to be a possibility. From the documentation (for InDesign CS2, but I'd imagine Photoshop to be similar):
Runs a script. The script can be either a file or a string.
The obvious downside to this is that it will only run AppleScript, JavaScript or VBScript scripts, not any arbitrary language. That said, you could probably hack something together on a Mac by calling an AppleScript which then called your Perl code directly. Passing data back and forth would probably be best described as 'icky', but it should be possible. I'm not sure if VBScript has similar external access for Windows systems.
Hope that helps.