I think that you're asking how to make it so that Linux can execute a Perl script you've written, as opposed to the other possible interpretation which is how to make a binary executable out of a Perl script. In the context of a linux environment where having a Perl interpreter installed is fairly ubiquitous, the latter interpretation doesn't seem to me what you're asking. But if I'm wrong, you may want to clarify.
Debian is a flavor of Linux, and any normal installation of Debian Linux would have Perl installed already. So executing is just a matter of making sure the proper modules are in place, and then moving on to the following:
This is mostly a Linux question, with one Perl component to it. So let's get the Perl part out of the way:
The first line of your script needs a "shbang line", which tells the shell where to find the Perl interpreter. That may be something like this:
#!/usr/bin/perl
Or it may be something else. If you type "which perl" at your shell you will see a path to Perl. To keep things simple you can usually just use that path, with the #! prepended to it as the first line of the script. Later on you may choose a more flexible shbang option.
Now on to the Linux component of the question. By typing the following:
chmod +x scriptname
(Thanks AnonymousMonk for catching my typo.)
You will be telling Linux that the file named "scriptname" is an executable.
The final step is to know how to invoke it. It either needs to be in a folder that is part of your path, or you will need to invoke it by qualifying the path. If you have to do the latter, just 'cd' into the folder where the script is and type ./scriptname
The ./ part is telling your system that the file you want to execute is in the current working directory. Otherwise the system will go looking for it in one of the directories specified in your path environment variable; eg, usually the various 'bin' directories, and possibly a few other places.
|