Please post your question separately with an appropriate subject. This make the thread easier to follow, and it helps people to find things later when searching.
property perlPath : "/Users/administrator/TEST/perlscript.pl"
(* perlscript.pl:
#!/usr/bin/perl
print "Hello.\n";
*)
set rslt to do shell script (quoted form of perlPath)
rslt -- "Hello."
Dealing with parameter passage is just slightly more involved, but is this all you’re looking for?
First, you need to escape the double quotes inside the script; Otherwise AppleScript thinks you’re closing the string.
Second, you need to check out the man for perl to see how to run commands from the command line; You give perl the -e option, followed the code to run (enclosed by quotes to protect it from the shell). (Also, you don’t need a hashbang line when you’re passing the script to the interpreter.)
Finally, echo causes errors on my machine; I think you want print instead.
set GUID to (do shell script "/usr/bin/perl -e'
$length = 36;
$possible = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZ\";
while (length($password) < $length) {
if (length($password) == 8 || length($password) == 13 || length($password) == 18 || length($password) == 23) {
$password .= \" - \";
}
$password .= substr($possible, (int(rand(length($possible)))), 1);
}
print $password;'")
A bit OT, but if you already know Perl, check out Chris Nandor’s Mac::Glue and Mac::OSA::Simple modules if you’ve not already done so - you may find them of use.