I don't think anyone has yet answered your first question --

What are the advantages to using Perl over AppleScript or vice versa?

AppleScript has the advantage that it's a little bit easier to learn for some folks, particularly non-programmers who view it as being more english-like. The advantage to programmers is that many programs have exposed an AppleScript API, so that people can write macros. AppleScript can also 'record' actions, making it even more like a macro writing language.

You can also be more assured that if the person's using a Mac, they'll have AppleScript -- even if it's pre-MacOS X.

What are the advantages of Perl? Well, I'm guessing in your case, you're more familiar with Perl, and if you're been using it for any sort of time, it's much more productive to work in a language you're familiar with, than to have to keep referring back to language documentation, and debug it.

But, Perl can't interfact with the applications -- for instance, to keep this on topic -- in BBEdit, it'll mark perl functions, so that you can quickly jump down to them. It doesn't, however, mark when you change packages within the same file, so the function scanner isn't useful when you're reading through SOAP::Lite or things written in a similar style. I use an AppleScript to set marks at the 'package' and 'sub' declarations (but it's on my machine at work, so I'll have to post it from there)

Update: Almost forgot to mention -- there are Applescript modules in CPAN, to call AppleScript from Perl

Update 2: AppleScript to mark Perl namespaces in BBEdit

tell application "BBEdit" activate mark text 1 of active document of text window 1 options {searching + for:"\\bpackage\\s+([a-zA-Z:0-9_]+)\\s*;", using:"\\1", clearing exi +sting:true} mark text 1 of active document of text window 1 options {searching + for:"\\bsub\\s+([a-zA-Z0-9_]+)\\s*(?:\\([^)]\\)\\s*)?{", using:" \\ +1", clearing existing:false} end tell

In reply to Re: Where does Perl fit into OS X? by jhourcle
in thread Where does Perl fit into OS X? by Acolyte

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.