in reply to ASCII Battleship Program
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.
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
In Section
Cool Uses for Perl