in reply to how to run perl file in linux

Easiest way is typing perl cpg4.pl at the bash prompt, This runs the perl interpreter on your program.

Another way is add a "shebang" (#!/usr/bin/perl) line at the beginning of your script and mark the script as executable with the "chmod" command, and then run it like any other executable script.

Replies are listed 'Best First'.
Re^2: how to run perl file in linux
by CountZero (Bishop) on May 13, 2014 at 13:55 UTC
    Of course, #!/usr/bin/perl will most likely run your system Perl, which may or may not be what you want. It is a good advice to install your "own" Perl in your home directory. Then you can install new modules and upgrade Perl without risking to break your system. Of course, the shebang should reflect the path to your own new Perl.

    If you find that this is all too difficult to manage, think about using perlbrew.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      CountZero brings up a good point. This issue is why I like to use
      #!/usr/bin/env perl
      as the shebang, when I am on a linux or Mac OS X system. This way, it will run the script using the first perl found in your path. This node contains some more discussion on the topic: /usr/bin/env perl - query