Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Regex Matching

by ww (Archbishop)
on Dec 05, 2012 at 21:48 UTC ( #1007410=note: print w/replies, xml ) Need Help??


in reply to Re: Regex Matching
in thread Regex Matching

but the thought lives on (edited to correct some rendering deficiencies)...

"Hi Monks,
"I'm in the process of writing a script that generates 8 Random Characters and the user has to make words from these characters. Each character can only be used once. For example, if the random sequence is FOTBIEIW and the user enters FOOT it will show an error message "No match". If the sequence was FOTBOIEW then FOOT would be acceptable.
"To generate the random letters im using:"

my @letter=('A'..'Z'); @rand=''; foreach(0..7){ $rand.=$letter[rand(@letter)];
</code>

"Then I get the user to enter a word split it into an array.

"This is where I get stuck."

for($count=0; $count<= ($wordLength - 1); $count++){ if($wordArray[$count] =~ /[$rand]/o{

Courtesy of Corion's good works (+ +), we have our own, local 'sorta go a ways back' machine.

Replies are listed 'Best First'.
Re^3: Regex Matching
by Kenosis (Priest) on Dec 05, 2012 at 21:54 UTC

    "Once the chalkboard has been erased, it can't be unerased..."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007410]
help
Chatterbox?
[choroba]: Russia didn't send them officially, they're on vacation in Korea
[LanX]: no that was Syria! ;-)
[LanX]: And the reason is: The world’s best players aren’t at this year’s Games after the NHL stopped its athletes from leaving in the middle of the season. ... LOL
[LanX]: horoba: you like ice hockey?
[choroba]: Like is a too strong word. But you can't evade it here.
LanX (for people wondering: yes field hockey still exists and is even more popular than Hasslhoff in Germany)
[Corion]: LanX: Ah, that explains a lot :)
[marto]: Nobody we spoke to in Berlin had a clue who Hasslhoff was
[erix]: heh: The Dutch do one thing very, very well
[LanX]: the sidekick of this blonde playboy model which was saving lives with her red bathing suit ... (what was her name again ...)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2018-02-23 16:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (303 votes). Check out past polls.

    Notices?