Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
than i will keep trying on. i am a beginger of perl ^_^ this is the code i wrote..but not working.
#!/usr/bin/perl -w ################################### # Name: scriptname.pl # Purpose: This script does… # Author: Ivan Zhibin He # Date written: 22/11/2012 ################################### my $string1 = rand_string1(); sub rand_string1 { my @chars = ('A'..'Z'); my $length = 0; my $string = ''; for (0..$length) { $string1 .= $chars[int rand @chars]; } return $string1; } ################################### my $string2 = rand_string2(); sub rand_string2 { my @chars = ('A'..'Z'); my $length = 0; my $string2 = ''; for (0..$length) { $string2 .= $chars[int rand @chars]; } return $string2; } ################################### my $string3 = rand_string3(); sub rand_string3 { my @chars = ('A'..'Z'); my $length = 0; my $string3 = ''; for (0..$length) { $string3 .= $chars[int rand @chars]; } return $string3; } ################################### my $string4 = rand_string4(); sub rand_string4 { my @chars = ('A'..'Z'); my $length = 0; my $string4 = ''; for (0..$length) { $string4 .= $chars[int rand @chars]; } return $string4; } ################################### my $string5 = rand_string5(); sub rand_string5 { my @chars = ('A'..'Z'); my $length = 0; my $string5 = ''; for (0..$length) { $string5 .= $chars[int rand @chars]; } return $string5; } ################################### my $string6 = rand_string6(); sub rand_string6 { my @chars = ('A'..'Z'); my $length = 0; my $string6 = ''; for (0..$length) { $string6 .= $chars[int rand @chars]; } return $string6; } ################################### my $string7 = rand_string7(); sub rand_string7 { my @chars = ('A'..'Z'); my $length = 0; my $string7 = ''; for (0..$length) { $string7 .= $chars[int rand @chars]; } return $string7; } ################################### my $string8 = rand_string8(); sub rand_string8 { my @chars = ('A'..'Z'); my $length = 0; my $string8 = ''; for (0..$length) { $string8 .= $chars[int rand @chars]; } return $string8; } ################################### ############to compare count###### my $count1 = $string1 =~ tr/"a-z" || "A-Z"//; my $count2 = $string2 =~ tr/"a-z" || "A-Z"//; my $count3 = $string3 =~ tr/"a-z" || "A-Z"//; my $count4 = $string4 =~ tr/"a-z" || "A-Z"//; my $count5 = $string5 =~ tr/"a-z" || "A-Z"//; my $count6 = $string6 =~ tr/"a-z" || "A-Z"//; my $count7 = $string7 =~ tr/"a-z" || "A-Z"//; my $count8 = $string8 =~ tr/"a-z" || "A-Z"//; print "The 1st string has $count1 letter\n"; print "The 2nd string has $count2 letter\n"; print "The 3rd string has $count3 letter\n"; print "The 4th string has $count4 letter\n"; print "The 5th string has $count5 letter\n"; print "The 6th string has $count6 letter\n"; print "The 7th string has $count7 letter\n"; print "The 8th string has $count8 letter\n"; print "Random string: |".$string1."|".$string2."|".$string3."|".$string4."|".$string5."|".$s +tring6."|".$string7."|".$string8."|\n"; print "Are these letters Acceptale to make words?\n"; $newWord = <>; chomp $newWord; ########################code need tobe fix!############## if ($newWord =~ /$string1[$string2] || [$string3] || [$string4] || [$s +tring5] || [$string6] || [$string7] || [$string8]] || $string2[$string1] || [$string3] || [$string4] || [$string5] || [$s +tring6] || [$string7] || [$string8]] || $string3[$string1] || [$string2] || [$string4] || [$string5] || [$s +tring6] || [$string7] || [$string8]] || $string4[$string1] || [$string2] || [$string3] || [$string5] || [$s +tring6] || [$string7] || [$string8]] || $string5[$string1] || [$string2] || [$string3] || [$string4] || [$s +tring6] || [$string7] || [$string8]] || $string6[$string1] || [$string2] || [$string3] || [$string4] || [$s +tring5] || [$string7] || [$string8]] || $string7[$string1] || [$string2] || [$string3] || [$string4] || [$s +tring5] || [$string6] || [$string8]] || $string8[$string1] || [$string2] || [$string3] || [$string4] || [$s +tring5] || [$string6] || [$string7]]/i) { print "Good\n"; } else { print "Bad\n"; }

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

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (8)
    As of 2014-09-01 14:52 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (13 votes), past polls