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

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??


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.


When your only tool is a hammer, all problems look like your thumb.

In reply to Re^3: Need help with Peal! by roboticus
in thread Need help with Peal! by ivanzhibin

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (8)
    As of 2018-06-18 16:05 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (110 votes). Check out past polls.