in reply to Re: Hangman Assistant
in thread Hangman Assistant

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

Replies are listed 'Best First'.
Re^3: Hangman Assistant
by Jorge_de_Burgos (Beadle) on Jul 13, 2009 at 14:05 UTC
    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';.
Re^3: Hangman Assistant
by jwkrahn (Monsignor) on Jul 13, 2009 at 00:54 UTC