saranperl has asked for the wisdom of the Perl Monks concerning the following question:

what is difference between Perl program and Perl script?

Replies are listed 'Best First'.
Re: perl vs script
by moritz (Cardinal) on Aug 04, 2009 at 11:49 UTC

      I like that, moritz! It's so true!

      I would have said: A script is a small program ans a program is a big script.


      s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
      +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

      very droll...

      Just a something something...
        :D perl, produced by dry humor
Re: perl vs script
by LanX (Saint) on Aug 04, 2009 at 10:48 UTC
    There are no sharp borders, it's basically about size and claim. see Scripting_language

    For me (!) a script is a short efficient hack which is supposed to just do a little job and doesn't have to meet quality criteria of larger projects (lifespan, modularity, clear scopes and namespaces (i.e. no global vars), encapsulation, documentation, maintainability, and so on ...)

    Sometimes scripts evolve into larger programs where all this quality aspects have to be added, but there is no magical byte added in this process, which turns a script into a "real" program.

    Cheers Rolf

    PS: Yeah and it's also a flame topic, because some people try to vilify Perl as "only a script language". But in the context of this board it's no fun, better try vi vs emacs for some action. ;-)

Re: perl vs script
by Anonymous Monk on Aug 04, 2009 at 10:49 UTC
Re: perl vs script
by Bloodnok (Vicar) on Aug 04, 2009 at 11:39 UTC
    Personally, I take the view that a program is a self-contained file that can only be run in a pre-compiled/ linked form e.g. an executable ... c/w a script, being any file, in text form, that can be/is interpreted on the fly by an external program.

    Hence in most cases, I view the terms perl script and perl program as being synonymous (since they both require an external perl binary + libraries in order to run) ... unless and until I've used perl2exe, Par or maybe even Wx::Perl::Packager to create a self-contained executable entity.

    A user level that continues to overstate my experience :-))
Re: perl vs script
by Old_Gray_Bear (Bishop) on Aug 04, 2009 at 17:53 UTC
    For me, a 'script' is a code that I can whip together in ten minutes or less to solve an immediate problem. It implies that there are no tests, packaging, and anything more that perfunctory documentation. Often, none of the corner cases are considered, since the problem that I am sorting is very specific.

    A program, on the other hand, is code that I expect to be hanging around for a while and needs the formal structure of POD, a test-harness, and a bit of thought in the design process. (Note: I often find that a script that I wrote twice last week really should become a program....)

    My people in the Computer Science disciplines make the distinction between 'script' and 'program' in terms of the mechanism that is used to run them. A script is run through an Interpreter; a program is run through a Compiler. The implication is that the Interpreter does not produce a reusable intermediate structure (no 'object code') that can be saved and used again later without reprocessing the source code. This distinction has gotten badly blurred in past decade or so, what with Just In Time Compilers and Interpreters that output byte-code-objects that are executed by a VM.

    ----
    I Go Back to Sleep, Now.

    OGB