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

Re: Perl Purity Test (For Update)

by nferraz (Monk)
on Mar 31, 2006 at 07:27 UTC ( [id://540438]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Perl Purity Test (For Update)

I wrote this script to play the above purity test:

#!/usr/bin/perl -w use strict; use Term::ReadKey; my %answer; while(<DATA>) { if (/^\.\.\./) { chomp; print "$_ (y/n)"; my $ans = ''; ReadMode('cbreak'); $ans = ReadKey(0) while ($ans ne 'y' and $ans ne 'n'); print "$ans\n"; ReadMode('normal'); $answer{$ans}++; $answer{t}++; } else { print; } } my $py = $answer{y} / $answer{t} * 100; my $pn = $answer{n} / $answer{t} * 100; print <<"EOF"; Results: You answered: $answer{y} 'yes' ($py %) $answer{n} 'no' ($pn %) EOF __DATA__

(Copy and paste the purity test after __DATA__)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://540438]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.