However this will not work if you are using Perl version prior to 5.10. This is the new feature which got introduced in Perl 5.10. For example, In perl 5.10 or later you can use “say” in place of “print”. There are certain cases where we want to specify the version of Perl to make our script work properly. How to specify version of Perl in the script? To run the program on Linux, Unix or Mac OS. Alternatively, if you are using Strawberry Perl or Active Perl then you can simply click run. Note: The above method is for running the perl program using command prompt. To run the program on Windows, open command prompt (cmd) and write the following command perl c:\perl\bin\perl.exe Perl doesn’t force you to use special kind of name, you are free to use any name you wish. In order to run the above program, copy the code into a text editor like notepad for windows, textedit for mac etc. Note the semicolon( ) at the end of instruction, you must put a semicolon at the end of every instruction, this tells interpreter that the instruction is finished. Third instruction prints “Hello World!!” prints Hello World!! on the screen. Second instruction #this is a comment is a comment, whatever you write after hash(#) is considered as comment Interpreter is what interpret this program into machine language. Here first instruction #!/usr/bin/perl tells Operating systems to run this program with the interpreter located at /usr/bin/perl.Īs I explained in the perl introduction that perl is a high level language that uses normal english, the problem is that machine doesn’t understand this high level language, therefore in order to make this program understandable by machine, we must interpret it into machine language. This is a simple perl program that prints Hello World!! on the screen. In this tutorial, we will learn how to write first perl program and run it on various Operating Systems.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |