property some_user_changeable_config_stuff : "this data can be changed by the user of the script usually this is some kind of template, containing placeholders the perl script will fill later. Note: The user usually knows nothing about perl but a bit about AppleScript. So he will happily be using stuff like @ Quotes % etc. " on run tell me to open { choose file } end run on open some_items repeat with this_item in some_items if info for this_item is not folder then do_stuff_with(this_item) end if end repeat en open on do_stuff_with(an_item) do shell script "perl -e " & (quoted form of " use strict; use warnings; # read DATA here e.g.: my $TEMPLATE; { local $/; $TEMPLATE= ; } # and now process while (<>) { # do something with the line and the # TEMPLATE } __DATA__" & (ASCII character 10) & some_user_changeable_config_stuff) & " " & (quoted form of POSIX path of an_item) end do_stuff_with