Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Problems? Is your data what you think it is?
 
PerlMonks  

Re^8: Need help with Peal!

by ivanzhibin (Initiate)
on Nov 26, 2012 at 22:53 UTC ( #1005771=note: print w/ replies, xml ) Need Help??


in reply to Re^7: Need help with Peal!
in thread Need help with Peal!

hi rob, here is my code , but it doesn;t show the repeated letter in those 8 randomly letter. can you help me how to implement that.

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; ################################### # Name: scriptname.pl # Purpose: This script does… ################################### # some data to stick into the hash my $string1 = rand_string(); my $string2 = rand_string(); my $string3 = rand_string(); my $string4 = rand_string(); my $string5 = rand_string(); my $string6 = rand_string(); my $string7 = rand_string(); my $string8 = rand_string(); sub rand_string { my @chars = ('A'..'Z'); my $length = 0; my $temp_string = ''; for (0..$length) { $temp_string .= $chars[int rand @chars]; } return $temp_string; } print "Random string: |".$string1."|".$string2."|".$string3."|".$string4."|".$string5."|".$s +tring6."|".$string7."|".$string8."|\n"; print "Are these letters Acceptale to make words?\n"; ##next # stick them into the hash my %hashCheckLetter; $hashCheckLetter{$string1}=0; $hashCheckLetter{$string2}=0; $hashCheckLetter{$string3}=0; $hashCheckLetter{$string4}=0; $hashCheckLetter{$string5}=0; $hashCheckLetter{$string6}=0; $hashCheckLetter{$string7}=0; $hashCheckLetter{$string8}=0; # What does the hash actually have in it? print Dumper(\%hashCheckLetter); # what letters are in the hash? for my $letter ('A'..'Z','a'..'z') { if (exists $hashCheckLetter{$letter}) { print "Found $letter!\n"; } else { print "Letter $letter not available\n"; } }


Comment on Re^8: Need help with Peal!
Download Code
Re^9: Need help with Peal!
by bulk88 (Priest) on Nov 27, 2012 at 05:22 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-04-17 23:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (458 votes), past polls