Results 1 to 2 of 2

Thread: Invocation of the Perl

  1. #1
    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

  2. #2
    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.

Similar Threads

  1. Remote method invocation in Java platform
    By kALAMATHI in forum Software Development
    Replies: 7
    Last Post: 17-01-2011, 11:17 PM
  2. What is PERL and what are its uses?
    By Gadin in forum Software Development
    Replies: 10
    Last Post: 08-01-2011, 07:33 PM
  3. What are the best Perl forums?
    By Megatruck in forum Software Development
    Replies: 5
    Last Post: 26-12-2010, 01:37 AM
  4. Perl VS Python
    By Trance Maniac in forum Software Development
    Replies: 6
    Last Post: 06-10-2010, 11:01 PM
  5. What are the different version of perl
    By Toraidio in forum Software Development
    Replies: 5
    Last Post: 15-02-2010, 02:47 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,294,504.02659 seconds with 17 queries