in reply to Re^6: Need help with Peal!
in thread Need help with Peal!
You really need to review how data in perl works--you're not going to figure it out by hacking on the keyboard.
A couple procedural hints:
For example, here's a little program you could have written to investigate hashes. Once you understand how it works, it'll be easier to work on your project.
$ cat t.pl #!/usr/bin/perl use strict; use warnings; use Data::Dumper; # some data to stick into the hash my $string1 = 'a'; # randomly generated my $string2 = 'f'; # randomly generated my $string3 = 'l'; # randomly generated my $string4 = 'g'; # randomly generated # stick them into the hash my %hashCheckLetter; $hashCheckLetter{$string1}=0; $hashCheckLetter{$string4}=0; $hashCheckLetter{$string3}=0; $hashCheckLetter{$string2}=0; # What does the hash actually have in it? print Dumper(\%hashCheckLetter); # what letters are in the hash? for my $letter ('a' .. 'h') { if (exists $hashCheckLetter{$letter}) { print "Found $letter!\n"; } else { print "Letter $letter not available\n"; } }
When run, it produces this:
$ perl t.pl $VAR1 = { 'l' => 0, 'a' => 0, 'g' => 0, 'f' => 0 }; Found a! Letter b not available Letter c not available Letter d not available Letter e not available Found f! Found g! Letter h not available
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Need help with Peal!
by ivanzhibin (Initiate) on Nov 26, 2012 at 22:53 UTC | |
by bulk88 (Priest) on Nov 27, 2012 at 05:22 UTC | |
|
Re^8: Need help with Peal!
by ivanzhibin (Initiate) on Nov 26, 2012 at 01:52 UTC | |
by roboticus (Chancellor) on Nov 26, 2012 at 02:50 UTC |