Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
A few comments:
  • All your subroutine definitions use the "no parameters" prototyping by virtue of adding "()" in their definitions. Indeed none of your subroutines take any parameters, so that is not wrong, but then you call al your subroutines by prepending "&" to their names which has the effect of ignoring any prototypes. It is far better to delete all the prototyping as it probably does not do what you think it does and also delete all the "&" in the sub-calls which serve no purpose here.
  • You have a peculiar way of naming your variables and subroutines. While not "wrong" as such, it is not the perlish way. I wonder what was your native computer language before you started programming in Perl. Anyhow, the use of "::" in variable names and subroutines is reserved for using packages ("namespaces", if you wish), but you do not use packages here and frankly for a program of this size that does not use any modules, it is overkill to use namespaces. Everything can safely live in the main package (which is the default package).
  • Your use of local is ... strange. Did you do it so your program runs under use strict;? Again, probably you have a wrong concept of what local does. If you want to declare global (in the sense of can-be-seen-and-accessed-everywhere) then you can safely use lexical "my" variables, placed outside of any subroutine or block.


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

In reply to Re: ASCII Battleship Program by CountZero
in thread ASCII Battleship Program by perlStuck

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (9)
    As of 2021-03-02 20:07 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (62 votes). Check out past polls.