First the file type and whether it is an executable (permission wise) or not.
If it's a text file then first line in is important. In your perl scripts a line that looks something like:
tells the shell to use /usr/bin/perl to run this script.
This line is called shebang.
Binary files are executed directly.