Daisy asked:
>Any ideas what makes this example run?
The example was missing a pair of parentheses. The following does work.

--------------------------------------------------------------------------
set argument to "This is passed to Perl"

set my text item delimiters to return
set perlScript to text items of ("/usr/bin/perl <<'__END__'
my $argument = <<'EOFARGS';
" & argument & "
EOFARGS
chomp $argument;
print qq(Perl was passed: $argument);
__END__
")
set my text item delimiters to ASCII character 10
do shell script (perlScript as text)

display dialog result
--------------------------------------------------------------------------

>Or can i use other variables (environment?) to pass arguments to the
>script?
You can export an environment variable on the command line that calls Perl.
As far as I can see this is less flexible than the Perl-based approach
above.

--------------------------------------------------------------------------
set argument to "This is passed to Perl"

set my text item delimiters to return
set perlScript to text items of ("export TEST=7;/usr/bin/perl <<'__END__'
print qq(Perl was passed: $ENV{TEST});
__END__
")
set my text item delimiters to ASCII character 10
do shell script (perlScript as text)

display dialog result
--------------------------------------------------------------------------

Gero Herrmann

Reply via email to