Все проще.
chmod +x perlscript
и первая строчка в нем :
#!/usr/bin perl -f
Т. е. если на файлике стоит бит исполнения (который ставится chmod +x) и если это не ELF и не shell и если первая строчка начинается с #!, то в продолжении ожидается как раз путь на программу интерпретатор, которой нужно этот файлик скормить
вот из man bash:
===
If the program is a file beginning with #!, the remainder of the first line specifies an interpreter for the program. The shell executes the specified interpreter on operating systems that do
not handle this executable format themselves. The arguments to the interpreter consist of a single optional argument following the interpreter name on the first line of the program, followed
by the name of the program, followed by the command arguments, if any.
===