#!/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."|".$string6."|".$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"; } }