Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: kakuro puzzle generator

by pKai (Priest)
on May 22, 2006 at 12:05 UTC ( #550913=note: print w/replies, xml ) Need Help??


in reply to kakuro puzzle generator

I violate the rules regarding global variable, strict and warnings.

Making it strict and warnings compliant was not very difficult and could be carried out in a quite mechanical way:

  • strict was satified after declaring 6 more sub-specific variables with my.
  • warnings were issued for using non-existant array/hash values. I silenced these by looking what kind of data is expected and making an appropriate || fallback, e.g. line 278 became:
    ($nl, $nd) = ( scalar(@{ ($tmp_across{$cur}||=[])->{locs} ||=[] }), scalar(@{ ($tmp_across{$cur}||=[])->{nums} ||=[] }) );
    this way

All in all not very demanding and nothing which should have caused much headache had your script been started with use strict; use warnings; as the first keystrokes right from the beginning of creating it.

As for the global variables... at least they already were cleanly declared, YMMV.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://550913]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2021-06-24 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (123 votes). Check out past polls.

    Notices?