Go Back   TechArena Community > Software > Tips & Tweaks
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Invocation of the Perl

Tips & Tweaks


Reply
 
Thread Tools Search this Thread
  #1  
Old 27-09-2010
Member
 
Join Date: Jul 2010
Posts: 75
Invocation of the Perl
  

The following tip can be useful while doing an Invocation of the Perl. Since each script must be interpreted by the program 'perl', and given that the scripts are just simple text file, must begin with the characters #! followed with the full path to the perl binary on your system, typically:
Code:
# / Usr / bin / perl 
or 
# / Usr / local / bin / perl
(To locate where it resides in your system, the Perl interpreter, type 'which perl' in a terminal even if, usually, the interpreter is installed in / usr / bin, but you can never know for sure). This, once the file is made executable (chmod 755 name_script.pl), is so that when the script runs, the kernel reads the first line and go find the interpreter, who then will the interpretation of rest of the code.

An alternative method to launch a perl script is to call 'perl' with the script name as argument:
perl script.pl

Reply With Quote
  #2  
Old 27-09-2010
Member
 
Join Date: Jul 2010
Posts: 75
Re: Invocation of the Perl

Perl recognizes many options, the most useful are:
  • -H displays a help page;
  • -D runs the script under the debugger;
  • -L automatically adds the line-feed, by adding at the end of each command 'print';
  • -V displays the version of the version of perl installed on your machine and exits;
  • -W displays some warnings about the script, very useful for finding errors.

All these (and many other options) are documented in "man perl" for perl4, and "man perlrun" for the five (5 perl manpage of the huge divide 4 in about 25 sections) in a Perl script, the hash (#) introduces a comment, and all that comes after it in a line is ignored.

Code:
print "Hello worldn" # This is a comment and is ignored, will 
# Only run the command "print"
The seams are often useful for himself and for those who read your code: for you for the fact that you can use them as the "notes" for example, remember to do something you've forgotten or left behind, the other for the greater easy to interpret your code, if you will publish your comments inside.
Reply With Quote
Reply

  TechArena Community > Software > Tips & Tweaks
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Invocation of the Perl"
Thread Thread Starter Forum Replies Last Post
Remote method invocation in Java platform kALAMATHI Software Development 7 17-01-2011 10:17 PM
What is PERL and what are its uses? Gadin Software Development 10 08-01-2011 06:33 PM
What are the best Perl forums? Megatruck Software Development 5 26-12-2010 12:37 AM
Perl VS Python Trance Maniac Software Development 6 06-10-2010 11:01 PM
What are the different version of perl Toraidio Software Development 5 15-02-2010 01:47 PM


All times are GMT +5.5. The time now is 03:25 PM.