• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Perl syntax
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Perl syntax


  • Subject: Re: Perl syntax
  • From: Helmut Fuchs <email@hidden>
  • Date: Sat, 14 Jun 2003 15:57:54 +0200

Hi Greg,

the way you send your script, perl doesn't try to execute it, but to load the script file named "use" instead. The complete error message should be something along these lines:
Can't open perl script "use": No such file or directory

Either save your perl script to disk and then execute
do shell script "perl pathtomyperlfile"

Or wrap your perl script into a singe line and use to -e switch of perl to execute a single line of code:

set shellscript to "$i=0; while($i<10) {print \"$i\\n\"; $i++};"
do shell script "perl -e '" & shellscript & "'"
display dialog result

Be careful to add \\ before any single ' you use in the perl script, as the backslash is needed on the command line you pass to the shell.

In the terminal, after executing perl in a line of its own you can type in a perl script directly on the terminal. When you then hit CTRL+D, then the script gets compiled and executed. I haven't managed to simulate that behaviour with "do shell script" - but then, I didn't try hard.

HTH,

Helmut
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Perl syntax (From: Greg Townsend <email@hidden>)

  • Prev by Date: Re: What happened to delimiters?
  • Next by Date: Re: Perl syntax
  • Previous by thread: Perl syntax
  • Next by thread: Re: Perl syntax
  • Index(es):
    • Date
    • Thread