Let's see if I have this right:
- you have an AppleScript application, which does some stuff and sets some "AppleScript variables"
- then the AppleScript thing invokes a perl command-line ("one-liner") script, which must:
- accept some stuff from stdin (some other process invoked by AppleScript is feeding the perl one-liner)
- accept some additional command line args? (or maybe not, or maybe this doesn't matter)
- accept some additional data which cannot be mixed with the stdin stream, and is not safe to provide as command-line args (for @ARGV), and this data content involves (some of) those "AppleScript variables".
If AppleScript provides a way to open a file for output, write variables to that file, and close it, then the perl script could simply open a given file, and read from that instead of from __DATA__ -- or I suppose you could go to the trouble of writing the whole perl script to a file, including the runtime-determined __DATA__ content, then execute it.
Or maybe you could turn things around: have a perl script that invokes AppleScript (via the "osascript" shell command), and reads the data it needs from that? (Just guessing)