Quick Navigation Bar overview :: introduction :: data structures [ toc | forums ] |
Note: If the document URL does not begin with https://randu.org/tutorials/perl/ then you are viewing a copy. Please direct your browser to the correct location for the most recent version. |
hello.pl
):
#!/usr/bin/perl print "Hello, World!\n";Amazed? Don't be. Perl is supposed to be this simple, a stark contrast to other languages. The first line signifies where the perl interpreter resides on the host system. This is usually /usr/bin/perl on Linux systems and /bin/perl under *NIX systems. The next statment is a simple print statement. That's it.
-c
switch lets perl check for syntax only, without running the
actual program. The -w
turns on all useful warnings.
You should ALWAYS develop your programs under -w.perl -w hello.plor we could make the perl file executable, by using the chmod command:
chmod 700 hello.pl ./hello.plBut then you ask, how do I issue the -w flag? Simple, put it in the perl line at line 1.
#!/usr/bin/perl -w
.#
.
Notice: Please do not replicate or copy these pages and
host them elsewhere. This is to ensure that the latest version can always
be found here.
Disclaimer: The document author has published these pages
with the hope that it may be useful to others. However, the document
author does not guarantee that all information contained on these
webpages are correct or accurate. There is no warranty, expressed or
implied, of merchantability or fitness for any purpose. The author does
not assume any liability or responsibility for the use of the information
contained on these webpages.
If you see an error, please send an email to the address below indicating
the error. Your feedback is greatly appreciated and will help to
continually improve these pages.