I think that you're asking how to make it so that Linux can execute a Perl script you've written, as opposed to the other possible interpretation which is how to make a binary executable out of a Perl script. In the context of a linux environment where having a Perl interpreter installed is fairly ubiquitous, the latter interpretation doesn't seem to me what you're asking. But if I'm wrong, you may want to clarify.

Debian is a flavor of Linux, and any normal installation of Debian Linux would have Perl installed already. So executing is just a matter of making sure the proper modules are in place, and then moving on to the following:

This is mostly a Linux question, with one Perl component to it. So let's get the Perl part out of the way:

The first line of your script needs a "shbang line", which tells the shell where to find the Perl interpreter. That may be something like this:

#!/usr/bin/perl

Or it may be something else. If you type "which perl" at your shell you will see a path to Perl. To keep things simple you can usually just use that path, with the #! prepended to it as the first line of the script. Later on you may choose a more flexible shbang option.

Now on to the Linux component of the question. By typing the following:

chmod +x scriptname

(Thanks AnonymousMonk for catching my typo.)

You will be telling Linux that the file named "scriptname" is an executable.

The final step is to know how to invoke it. It either needs to be in a folder that is part of your path, or you will need to invoke it by qualifying the path. If you have to do the latter, just 'cd' into the folder where the script is and type ./scriptname

The ./ part is telling your system that the file you want to execute is in the current working directory. Otherwise the system will go looking for it in one of the directories specified in your path environment variable; eg, usually the various 'bin' directories, and possibly a few other places.


Dave


In reply to Re: how to make a debian of a perl program. by davido
in thread how to make a debian of a perl program. by ansh batra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.