Basics of a Perl Program
You should already be familiar with HTML, and so you know that certain things are necessary in the structure of an HTML document, such as the and tags, and that other tags like links and images have a certain allowed syntax. Perl is very similar; it has a clearly defined syntax, and if you follow those syntax rules, you can write Perl as easily as you do HTML.
The first line of your program should look like this:
The first part of this line, #!, indicates that this is a script. The next part, /usr/bin/perl, is the location (or path) of the Perl interpreter. If you aren’t sure where Perl lives on your system, try typing which perl or whereis perl in the shell. If the system can find it, it will tell you the full path name to the Perl interpreter. That path is what you should put in the above statement.
If you’re using ActivePerl on Windows, the path should be /perl/bin/perl instead.
The final part contains optional flags for the Perl interpreter. Warnings are enabled by the -w flag. Special user input taint checking is enabled by the -T flag. We’ll go into taint checks and program security later, but for now it’s good to get in the habit of using both of these flags in all of your programs.
You’ll put the text of your program after the above line.