On Sun, 7 Jun 2009, chiluveru snehith wrote:

> hi
> 
> i am useing perl .5.0.10 so can any one tell me how compile the program and 
> run it
> 
> thanks
> snehith
> 

0. PERL is an interpreted language. Write the script and run it.

Here are the steps for BSD/UNIX/Solaris/Linux platforms.

Run your script from the command line (aka shell).

a simple hello world program in Perl.


#!/usr/bin/env perl

use warnings;

print "hello world";

exit 0;


assuming you write the above program in a file hello.pl
you change the permissions on the file by

chmod +x hello.pl

Now on the shell, you just run the program as

$ ./hello.pl


Points to note:

1. perl interpreter path is not hard coded

2. 'env' is specified to find and execute 'perl' 

3. 'use warnings' replaces -w flag

4. 'exit 0' marks the end of the script

Hope this helps.


thanks
Saifi.

Reply via email to