Finding file in parent folder of an AppleScript

applescriptcommand linepathscript

I have an AppleScript that calls another script (a perl script in this case) which resides in the same folder as the AppleScript.
Now I'm trying to put the script into a variable like this:

tell application "Finder"
    set scriptPath to POSIX path of (container of (path to me) as text)
    set perlScript to (do shell script "find " & quoted form of scriptPath & " -name myscript.pl")
end tell

But the result that I get from the find shell command has two slashes before the file name: /path/to/folder//myscript.pl
Anyone any idea what I'm doing wrong?

EDIT:
While I don't quite understand the double slash I managed to resolve the problem by not invoking the Finder at all and doing the following:

set scriptPath to POSIX path of (path to me) -- path to AppleScript
set scriptFolder to do shell script "dirname " & quoted form of scriptPath -- path to folder with AppleScript
set perlScript to (do shell script "find " & quoted form of scriptFolder & " -name myscript.pl") -- path to PerlScript

Don't know if that's the best way to do it but it works for me.

Best Answer

Here is an answer to get right the pathname of .. from AppleScript:

Get Current Path to Script within AppleScript and Append Subdirectory

Anyway, the actual construct you got: /path/to/folder//myscript.pl is a correct pathname to your Perl script. The 1st / is coming from the terminal one coming from container: /path/to/folder/.

Hence your built find command is very similar to this one you might try to experiment:

find ~/ -name "Documents" -print

Hint: work directly in Perl, it is many times more efficient than any AppleScript.