Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Looking for pointers or optimizations.

by tobyink (Abbot)
on Aug 21, 2012 at 13:55 UTC ( #988739=note: print w/replies, xml ) Need Help??

in reply to Looking for pointers or optimizations.

#!/usr/bin/env perl use 5.010; use strict; use constant LIMIT => 8; my $word = uc "hello"; my $wrong = 0; my $already = ''; my $displayed; while ($wrong < LIMIT) { $displayed = join '', map { m{ ^ [ $already ] $ }x ? $_ : '*' } split '', $word; if ($displayed eq $word) { say "Yeah, baby, yeah!"; exit(0); } say "Word: $displayed", say "Wrong guesses: $wrong"; print "Please guess a letter... "; chomp(my $guess = <>); $already .= ($guess = quotemeta uc $guess); $wrong++ unless $word =~ m{ $guess }x; } die("Dude, it was '$word'\n");
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2016-09-27 17:46 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (509 votes). Check out past polls.