Sample perl script to print hello world

 

Hi,

 

This post is a simple perl script to print the sentence “Hello World”.

 

#/usr/bin/perl -w

print "Hello World \n";

 

Output:

 Hello World

 

Here I have added \n to make the perl compiler to end the particular line. Make sure that you use “”(double quotes) rather than ”(single quotes) because by default perl won’t compile the values inside single quotes. So the output will print \n also. Something like “Hello World \n” which is not a desired output which we require.

 

Thanks for viewing helpinlinux.com

Leave a Reply

Protected by WP Anti Spam