Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    perl
  » Hello World in perl
      by tin_man
 Page 1 of 1 
   

(Login to remove green text ads)
Everyone needs a place to start, and the Hello World program is as good a place as any. This is a really simple script, just displays the string "Hello World".

Code:
#!/usr/bin/eval perl -w print "Hello World";
that's it :-D
Let's look at that line by line though

Code:
#!/usr/bin/eval perl -w
this line is the shebang line, it tells the OS what to use to intrepert the file with, I prefer to use /usr/bin/eval perl as opposed to just /usr/bin/perl because it gives your script more portability. The -w switch tells the perl intrepter to spit out warning, very useful for debuging.

Code:
print "Hello World";
This is pretty self-explainatory, it prints "Hello World", notice though that in perl as in C/C++, lines end in a semi-colon.




 
 Page 1 of 1 
   

Rate This Article
1 2 3 4 5 6 7 8 9 10





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle