Monday, September 13, 2010

Running a perl program

Explicitly invoking the Perl compiler/interpreter
(note that >>> is prompt only)
>>>perl program.pl
Many command line options are available here eg.
-w print all warnings
-c check but do not execute
-d run under debugger control

Implicitly invoking the Perl compiler/interpreter
It is system specific. e.g. Unix
#!/usr/bin/perl
print "Please enter your name: ";
One can also use -w etc options here also
Eg. #!/usr/bin/perl -w

Other thing is changed the permission of perl file by chmod command to executable and run it as normal executable file.

No comments:

Post a Comment