set theWindowTitle to "PerlMonks"
set theSuffix to text returned of (display dialog "Enter a file suffix:" & return default answer "" with title theWindowTitle)
set theFolder to (choose folder with prompt "Enter directory")
set thePerlScript to quoted form of (POSIX path of ((choose file with prompt "Select a script:") as Unicode text))
-- display dialog "Script: " & thePerlScript with title theWindowTitle
tell application "Finder"
set theFiles to (every file of theFolder whose name extension is theSuffix) --as alias list
end tell
repeat with theFile in theFiles
set theFile to quoted form of (POSIX path of (theFile as Unicode text))
display dialog "Found: " & theFile with title theWindowTitle
set theResult to do shell script thePerlScript & " " & theFile
display dialog "Result: " & theResult with title theWindowTitle
-- beep
end repeat
####
#!/usr/bin/perl
while (<>) {print}
####
Karls-Mac-mini:find karl$ cat foo.txt bar.txt
foo
bar