The world's shortest 'Hello World!' program: a proposal

Discussion in 'Perl Misc' started by Larry, Jan 18, 2005.

  1. Larry

    Larry Guest

    Having a superlative description of a language is a great promotional
    aid. For example: "best at text processing", "best for distributed web
    apps", "fastest for 3d games" etc...

    One claim that Perl can make is one of the most simple and shortest
    'Hello World' programs.

    There is rumor on the web that there is another language which will
    execute the code:

    Hello World

    and print:

    Hello World

    My proposal for Perl6 is to make Perl execute a sequence of code which
    is 0 bytes in length with the action of printing to STDOUT:

    Hello World

    Currently, attempting to execute a file or string of code with no
    content will do absolutely nothing.

    Of course, with the -W flag, Perl would continue to do nothing, and if
    one were to use strict, it would no longer be an empty file and
    therefore would properly execute by strictly doing absolutely nothing.

    The controversy in this proposal may be the way in which to state:

    Hello World

    Here are a few alternatives that have been used traditionally:

    Hello, World
    Hello, World!
    Hello world.
    hello world...

    And with the current aggressiveness of Nasa in exploring new worlds,
    one might consider changing it to:

    Hello Worlds!
    Larry, Jan 18, 2005
    #1
    1. Advertising

  2. Larry

    Ken Guest

    Larry wrote:
    > Having a superlative description of a language is a great promotional
    > aid. For example: "best at text processing", "best for distributed web
    > apps", "fastest for 3d games" etc...
    >
    > One claim that Perl can make is one of the most simple and shortest
    > 'Hello World' programs.
    >
    > There is rumor on the web that there is another language which will
    > execute the code:
    >
    > Hello World
    >
    > and print:
    >
    > Hello World
    >
    > My proposal for Perl6 is to make Perl execute a sequence of code which
    > is 0 bytes in length with the action of printing to STDOUT:
    >
    > Hello World
    >
    > Currently, attempting to execute a file or string of code with no
    > content will do absolutely nothing.
    >
    > Of course, with the -W flag, Perl would continue to do nothing, and if
    > one were to use strict, it would no longer be an empty file and
    > therefore would properly execute by strictly doing absolutely nothing.
    >
    > The controversy in this proposal may be the way in which to state:
    >
    > Hello World
    >
    > Here are a few alternatives that have been used traditionally:
    >
    > Hello, World
    > Hello, World!
    > Hello world.
    > hello world...
    >
    > And with the current aggressiveness of Nasa in exploring new worlds,
    > one might consider changing it to:
    >
    > Hello Worlds!
    >


    lol (this IS a joke, right?)

    Ken
    Ken, Jan 18, 2005
    #2
    1. Advertising

  3. "Ken" <> wrote in message
    news:gXeHd.59$...
    > Larry wrote:
    >> Having a superlative description of a language is a great promotional
    >> aid. For example: "best at text processing", "best for distributed web
    >> apps", "fastest for 3d games" etc...
    >>
    >> One claim that Perl can make is one of the most simple and shortest
    >> 'Hello World' programs.
    >>
    >> There is rumor on the web that there is another language which will
    >> execute the code:
    >>
    >> Hello World
    >>
    >> and print:
    >>
    >> Hello World
    >>
    >> My proposal for Perl6 is to make Perl execute a sequence of code which
    >> is 0 bytes in length with the action of printing to STDOUT:
    >>
    >> Hello World
    >>
    >> Currently, attempting to execute a file or string of code with no
    >> content will do absolutely nothing.
    >>
    >> Of course, with the -W flag, Perl would continue to do nothing, and if
    >> one were to use strict, it would no longer be an empty file and
    >> therefore would properly execute by strictly doing absolutely nothing.
    >>
    >> The controversy in this proposal may be the way in which to state:
    >>
    >> Hello World
    >>
    >> Here are a few alternatives that have been used traditionally:
    >>
    >> Hello, World
    >> Hello, World!
    >> Hello world.
    >> hello world...
    >>
    >> And with the current aggressiveness of Nasa in exploring new worlds,
    >> one might consider changing it to:
    >>
    >> Hello Worlds!
    >>

    >
    > lol (this IS a joke, right?)
    >
    > Ken
    >


    Lol, I can't tell if it is or not, but it would be quit funny :D
    Lenny
    Leonard Challis, Jan 18, 2005
    #3
  4. "Leonard Challis" <> wrote in news:csk2ht$udm$1
    @newsg2.svr.pol.co.uk:

    > "Ken" <> wrote in message
    > news:gXeHd.59$...
    >> Larry wrote:


    ....

    >>> One claim that Perl can make is one of the most simple and shortest
    >>> 'Hello World' programs.

    ....

    >>>

    >>
    >> lol (this IS a joke, right?)


    > Lol, I can't tell if it is or not, but it would be quit funny :D


    Please stop feeding the troll.

    Sinan.
    A. Sinan Unur, Jan 18, 2005
    #4
  5. Larry

    Wes Groleau Guest

    Wes Groleau, Jan 19, 2005
    #5
  6. A. Sinan Unur wrote:
    > "Leonard Challis" <> wrote in news:csk2ht$udm$1
    > @newsg2.svr.pol.co.uk:
    >
    >> "Ken" <> wrote in message
    >> news:gXeHd.59$...
    >>> Larry wrote:

    >
    > ...
    >
    >>>> One claim that Perl can make is one of the most simple and shortest
    >>>> 'Hello World' programs.

    > ...
    >
    >>>>
    >>>
    >>> lol (this IS a joke, right?)

    >
    >> Lol, I can't tell if it is or not, but it would be quit funny :D

    >
    > Please stop feeding the troll.
    >
    > Sinan.


    Why is he (the OP I assume you were referring to) automatically a troll?
    Seemed like a totally harmless "ha ha" orientated question. (If the
    person has otherwise truely proved to be a "troll", then I apologize in
    advance.)

    And if you really think about it, printing /something/ for a completely
    empty program (0 bytes), such as version info, rather then a variant of
    "hello world", could be useful.

    Or how about this, when configuration Perl for the first time, have a
    question/option to change the default behavior for 0 byte programs
    (default being the do nothing) with the printing of some useful
    information, like version, or a 3rd option to print "hello World"
    instead. That way everyone can be happy.

    Could be useful. :)
    Alfred Z. Newmane, Jan 19, 2005
    #6
  7. Larry

    Guest

    Larry <> wrote:
    > The controversy in this proposal may be the way in which to state:
    > Hello World


    > Here are a few alternatives that have been used traditionally:
    > Hello, World
    > Hello, World!
    > Hello world.
    > hello world...
    > Hello Worlds!


    You've missed out the canonical grandfather of them all (Kernigan and
    Ritchie, "The C Programming language"):

    ObPerl
    print "hello, world\n"

    Chris
    , Jan 19, 2005
    #7
  8. "A. Sinan Unur" <> wrote in message
    news:Xns95E2B2F0BEBADasu1cornelledu@132.236.56.8...
    > "Leonard Challis" <> wrote in news:csk2ht$udm$1
    > @newsg2.svr.pol.co.uk:
    >
    >> "Ken" <> wrote in message
    >> news:gXeHd.59$...
    >>> Larry wrote:

    >
    > ...
    >
    >>>> One claim that Perl can make is one of the most simple and shortest
    >>>> 'Hello World' programs.

    > ...
    >
    >>>>
    >>>
    >>> lol (this IS a joke, right?)

    >
    >> Lol, I can't tell if it is or not, but it would be quit funny :D

    >
    > Please stop feeding the troll.
    >
    > Sinan.


    That exactly what I mean about people getting flamed for no reason.
    Seems to me some people have real social problems. It's a shame.

    Lenny
    Leonard Challis, Jan 19, 2005
    #8
  9. On 18 Jan 2005 10:22:22 -0800, "Larry" <> wrote:

    >Having a superlative description of a language is a great promotional
    >aid. For example: "best at text processing", "best for distributed web
    >apps", "fastest for 3d games" etc...


    Do we need more script kiddies, by any chance?

    >One claim that Perl can make is one of the most simple and shortest
    >'Hello World' programs.


    I wouldn't think this as of being one of its strongest point nor one
    of the reasons I love it so much, but...

    >There is rumor on the web that there is another language which will
    >execute the code:
    >
    >Hello World
    >
    >and print:
    >
    >Hello World


    Good for them!

    FWIW I would fear such a "feature".

    >My proposal for Perl6 is to make Perl execute a sequence of code which


    Please note that you should make your proposals for Perl6 in p6l.

    I think you'll find, as I did myself, that people here is more
    concerned, and by large, with how to do stuff in perl, rather than in
    discussions about proposals about Perl{5,6}. (Even if I personally
    whish there were more activity/responsiveness in this sense, but it
    doesn't count.)

    As a side note indeed large parts of Perl6's syntax and semantics are
    still being actively redefined, rethought, etc. _but_ I doubt
    (s/doubt/am sure/) that a similar proposal could ever be accepted, let
    alone the motivations you gave for it...

    >is 0 bytes in length with the action of printing to STDOUT:


    _What_ is "0 bytes in length"? I can't see anything in your example!!

    >Currently, attempting to execute a file or string of code with no
    >content will do absolutely nothing.


    HUH?!? What is "string of code with no content". Note that the empty
    program _is_ a valid program, and it's also the simples trie, in that
    it _does_ print itself, i.e. nothing.

    >Of course, with the -W flag, Perl would continue to do nothing, and if


    It's a particular idea of yours that "perl does nothing" when you give
    it a script containing e.g. "hello world\n" and nothing else: it does
    a whole lot of things, and it emits an error.

    >one were to use strict, it would no longer be an empty file and
    >therefore would properly execute by strictly doing absolutely nothing.


    Another thing that you'll find out it that in Perl6 strict and
    warnings will be turned on _by default_ in most cases, with the most
    notable exception being given by one-liners specified by means of -e.

    >The controversy in this proposal may be the way in which to state:
    >
    >Hello World
    >
    >Here are a few alternatives that have been used traditionally:
    >
    >Hello, World
    >Hello, World!
    >Hello world.
    >hello world...


    WHich drug are you taking? Can I have some?!?

    >And with the current aggressiveness of Nasa in exploring new worlds,
    >one might consider changing it to:
    >
    >Hello Worlds!


    Wow, I didn't expect you to have such a brilliant sense of humor...


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Jan 19, 2005
    #9
  10. On Tue, 18 Jan 2005 16:10:35 -0500, Ken <> wrote:

    >Larry wrote:

    [snip 45 more lines]

    >lol (this IS a joke, right?)


    I don't think so, but I'm not really sure the OP is a troll either.
    But then why quoting his whole message (which is alread a waste of
    electrons in the first place)? Well, I see, your cmt applies to all of
    it, so in some sense it does make sense, but... oh, well: you have
    trimmed it down. All in all you're right: if it were a joke, then it
    would have been funny after all!


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Jan 19, 2005
    #10
  11. On Tue, 18 Jan 2005 22:28:23 -0000, "Leonard Challis"
    <> wrote:

    >"Ken" <> wrote in message

    [snip 47 more lines]

    >> lol (this IS a joke, right?)


    >Lol, I can't tell if it is or not, but it would be quit funny :D


    And did you really need to include a full quote of a message already
    including a quote of the whole OP's immortal prose, just to add this
    pearl of wisdom?!?


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Jan 19, 2005
    #11
  12. Leonard Challis <> wrote:

    > That exactly what I mean about people getting flamed for no reason.



    Have you considered that there might _be_ a reason, but that you do
    not know what it is?

    There is always a reason, IMO.

    The debate could be about whether or not it is a good reason though.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 20, 2005
    #12
  13. Heh, I guess your right. I admit there probably is a reason and whatever it
    is I apologise.

    Some people do seem to be quite untowards however, no matter the
    circumstance, creating a mixed atmosphere.

    Lenny

    "Tad McClellan" <> wrote in message
    news:...

    > Have you considered that there might _be_ a reason, but that you do
    > not know what it is?
    >
    > There is always a reason, IMO.
    >
    > The debate could be about whether or not it is a good reason though.
    Leonard Challis, Jan 20, 2005
    #13
  14. Larry

    Wes Groleau Guest

    Hue-Bond wrote:
    >>Note that the empty program _is_ a valid program, and it's also the
    >>simples trie, in that it _does_ print itself, i.e. nothing.

    >
    > Hmm? How could an empty program *print* something? Even if that something is
    > the empty string.


    Nothing in, nothing out. Basic computer science.

    --
    Wes Groleau

    A pessimist says the glass is half empty.

    An optimist says the glass is half full.

    An engineer says somebody made the glass
    twice as big as it needed to be.
    Wes Groleau, Jan 20, 2005
    #14
  15. Wes Groleau <> wrote in
    news::

    > Hue-Bond wrote:
    >>>Note that the empty program _is_ a valid program, and it's also the
    >>>simples trie, in that it _does_ print itself, i.e. nothing.

    >>
    >> Hmm? How could an empty program *print* something? Even if that
    >> something is the empty string.

    >
    > Nothing in, nothing out. Basic computer science.


    Actually, that is "Garbage in, garbage out".

    C:\Home\asu1\UseNet\clpmisc> perl -e
    No code specified for -e.

    Nothing in, something out.

    Sinan.
    A. Sinan Unur, Jan 20, 2005
    #15
  16. "A. Sinan Unur" <> writes:
    > Wes Groleau <> wrote in
    > news::
    >
    > > Hue-Bond wrote:
    > >>>Note that the empty program _is_ a valid program, and it's also the
    > >>>simples trie, in that it _does_ print itself, i.e. nothing.
    > >>
    > >> Hmm? How could an empty program *print* something? Even if that
    > >> something is the empty string.

    > >
    > > Nothing in, nothing out. Basic computer science.

    >
    > Actually, that is "Garbage in, garbage out".
    >
    > C:\Home\asu1\UseNet\clpmisc> perl -e
    > No code specified for -e.
    >
    > Nothing in, something out.


    arndt ~/perl 4011> perl -e ''
    arndt ~/perl 4012>

    Empty in, empty out. (No, I didn't say "nothing".)
    Arndt Jonasson, Jan 20, 2005
    #16
  17. Larry

    phaylon Guest

    Ken wrote:

    > Yes, I did need to quote the whole message.


    Why?

    --
    http://www.dunkelheit.at/
    That is not dead, which can eternal lie,
    and with strange aeons even death may die.
    -- H.P. Lovecraft
    phaylon, Jan 20, 2005
    #17
  18. On Wed, 19 Jan 2005 21:31:09 +0000 (UTC), Hue-Bond
    <> wrote:

    >> _What_ is "0 bytes in length"? I can't see anything in your example!!

    >
    >Of course, it's 0 bytes ;^).


    ;-)

    >> Note that the empty program _is_ a valid program, and it's also the
    >> simples trie, in that it _does_ print itself, i.e. nothing.

    >
    >Hmm? How could an empty program *print* something? Even if that something is
    >the empty string.


    I think this may get more into phyolosophy than computer programming.
    But _no_ output is the output of an "empty" print, thus the effects
    are indistinguishable. Since we're talking about _output_ this point
    of view seems sensible to me. If you want to take into account
    "internal degrees of freedom", then yes: in one case you have a call
    to print() and in one you don't. Does it matter?


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Jan 20, 2005
    #18
  19. I think the _original_ point was that if you had "script.pl" and that
    contained _no_ data, instead of doing nothing, the Perl Interpreter cheekily
    outputted "Hello World!" or something.

    Let us not argue! :D
    Lenny
    Leonard Challis, Jan 20, 2005
    #19
  20. "Leonard Challis" <> writes:
    > I think the _original_ point was that if you had "script.pl" and that
    > contained _no_ data, instead of doing nothing, the Perl Interpreter cheekily
    > outputted "Hello World!" or something.


    Only, it doesn't.

    emschwar@wilson:~$ touch script.pl
    emschwar@wilson:~$ perl script.pl
    emschwar@wilson:~$

    -=Eric
    --
    Come to think of it, there are already a million monkeys on a million
    typewriters, and Usenet is NOTHING like Shakespeare.
    -- Blair Houghton.
    Eric Schwartz, Jan 20, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rahul Gandhi

    hello world program

    Rahul Gandhi, Aug 29, 2003, in forum: C++
    Replies:
    15
    Views:
    701
    Greg P.
    Aug 29, 2003
  2. penguinman
    Replies:
    3
    Views:
    348
    Kevin Goodsell
    Sep 5, 2003
  3. swisscheese

    Shortest prime number program

    swisscheese, Feb 11, 2006, in forum: Python
    Replies:
    19
    Views:
    620
    Tim Hochberg
    Feb 13, 2006
  4. vijay
    Replies:
    8
    Views:
    689
  5. Roy
    Replies:
    6
    Views:
    578
    Roedy Green
    Jan 7, 2008
Loading...

Share This Page