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

Re: Hangman Assistant

by Jorge_de_Burgos (Beadle)
on Jul 12, 2009 at 11:22 UTC ( #779342=note: print w/replies, xml ) Need Help??


in reply to Hangman Assistant

An easy internationalization step that won't trouble you Americans a lot ;). Just change

/usr/share/dict/american-english

to

/usr/share/dict/words

This will make your program use the default user dictionary instead of hardcoding the American-English. At least under Debian.

Replies are listed 'Best First'.
Re^2: Hangman Assistant
by Lawliet (Curate) on Jul 12, 2009 at 19:53 UTC

    Ah, good call.

    Now what to do about the next if =~ /[^a-z]/;...

    I don't mind occasionally having to reinvent a wheel; I don't even mind using someone's reinvented wheel occasionally. But it helps a lot if it is symmetric, contains no fewer than ten sides, and has the axle centered. I do tire of trapezoidal wheels with offset axles. --Joseph Newcomer

      A good line for a perl program aimed at running under various languages under modern Linux systems would be this:

      use encoding ':locale';

      That way, all calculations about string length (among others) are base on characters and not on bytes. For example, many Spanish characters, under a UTF-8 system such as mine (Ubuntu 9.04), are coded in a 2-byte scheme--but this should be transparent to the programmer. So that length('aņo') yields 4 before adding use encoding ':locale'; and length('aņo') yields 3 after adding use encoding ':locale';.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2023-02-02 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (16 votes). Check out past polls.

    Notices?