|
Quick Navigation Bar overview :: introduction :: data structures [ toc | forums ] |
Note: If the document URL does not begin with http://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.#.
