I'm trying to replicate the following behavior in Perl 6, but can't figure out 
a "natural" way to do this (the task is filling in guessed letters for a 
hangman game):

    while ( $word =~ /$letter/g ) {
        $guess[ pos($word) - 1 ] = $letter;
    }

What would be the "canonical" Perl 6 way of doing this?  Preferably one which 
works with the current state of Rakudo :)


Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Reply via email to