Calling Applescript from Perl

:::perl
sub osascript($) { system 'osascript', map { ('-e', $_) } split(/\n/, $_[0]); } 

and to use it:

:::applescript
osascript <<END;
tell application "Finder"
display dialog "Hello"
end tell
END

source