» Hello World in perl by tin_man |
|
(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.
|
|