Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-23 18:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found