in reply to Re^2: Need help with Peal!
in thread Need help with Peal!
Please go back and edit your node to add code tags (<c>your code goes here</c>) to your post: It's pretty difficult to make sense of it.
I went ahead and reformatted some of it on my machine to see what you're doing, but didn't finish. I saw a couple of things that you'll want to learn before proceeding.
First: the point of a subroutine is to let you reuse code, rather than writing it over and over. Specifically, you don't need all the rand_string1 through rand_string8 subroutines. They all do the exact same thing. This does the same thing as the first section of your program:
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; }
The variable name you use inside of your subroutine doesn't have to be related to the variable name outside of your subroutine.
Next, I don't know what you think this line does:
my $count1 = $string1 =~ tr/"a-z" || "A-Z"//;
But I'm pretty sure it doesn't do what you want. You'll want to read over the documentation for tr in the documentation (perldoc -f perlop).
I'll check back later and see how things are going.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Need help with Peal!
by ivanzhibin (Initiate) on Nov 24, 2012 at 22:12 UTC | |
by roboticus (Chancellor) on Nov 25, 2012 at 02:07 UTC | |
by Anonymous Monk on Nov 25, 2012 at 22:54 UTC | |
by roboticus (Chancellor) on Nov 26, 2012 at 01:16 UTC | |
by ivanzhibin (Initiate) on Nov 26, 2012 at 22:53 UTC | |
| |
by ivanzhibin (Initiate) on Nov 26, 2012 at 01:52 UTC | |
| |
by bulk88 (Priest) on Nov 27, 2012 at 05:14 UTC | |
Re^4: Need help with Peal!
by Anonymous Monk on Dec 01, 2012 at 14:04 UTC | |
by roboticus (Chancellor) on Dec 01, 2012 at 15:12 UTC |