Okay, I gave it a shot:

sub f { # 38 characters # ($a,$b)=@_;$a=~s/_/./g;grep{/^$a$/}@$b # UPDATE: After seeing everyone use y///, I decided to join in: # 37 characters ($a,$b)=@_;$a=~y/_/./;grep{/^$a$/}@$b } sub g { # 186 characters # my($c,$d,@e)=@_;my$g='[^'.(join'',@e).']';$c=~s/_/$g/ge;my(%f,$j,@i) +;for$j(grep{/$c/}@$d){map{$f{$_}+=($j=~s/$_/$_/g)}(grep{/$g/}('a'..'z +'))}@i=(sort{$f{$a}<=>$f{$b}}keys%f);return pop@i # UPDATE: I forgot that you didn't have to join the list... # 166 characters my($c,$d,@e)=@_;$c=~s/_/[^@e]/ge;my(%f,$j,@i);for$j(grep{/$c/}@$d){map +{$f{$_}+=($j=~s/$_/$_/g)}(grep{/[^@e]/}('a'..'z'))}@i=(sort{$f{$a}<=> +$f{$b}}keys%f);return pop@i }

These seem to work with my test cases, but I'm sure someone can break them... This was a fun one, thanks Masem.

Update: There weren't any answers when I started, and I noticed after I finished posting that my solution to Part 1 is almost the same to japhy's. Before anyone leaves a note, I didn't rip him off... Actually, I'm pretty pleased with myself that I had the same idea as the Lord of all Regexes himself.

"We're experiencing some Godzilla-related turbulence..."


In reply to Re: (Golf) Hangman Player by patgas
in thread (Golf) Hangman Player by Masem

Title:
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, details, 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, summary, 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.