<?xml version="1.0" encoding="windows-1252"?>
<node id="1005402" title="Regex to compare (if) two strings (Uniquely - I will explain inside)" created="2012-11-24 12:26:00" updated="2012-11-24 12:26:00">
<type id="115">
perlquestion</type>
<author id="1005392">
chickenlips</author>
<data>
<field name="doctext">
&lt;p&gt;Obtained 8 random chars in a sub. Called it $random_string. &lt;/p&gt;

&lt;p&gt;Input a word from user (that they make FROM the 8 random chars such as in Scrabble). &lt;/p&gt;

&lt;p&gt;Gotta validate the inputted word by checking that it indeed consists of the chars in $random_string. &lt;/p&gt;

&lt;p&gt;The KEY BIT I CANNOT FIGURE OUT IS: I need to check that any letters used in the randomly generated for the inputted word are only used ONCE. &lt;/p&gt;



&lt;p&gt;Basically a simple version of Scrabble, this is what i have so far: &lt;/p&gt;

&lt;code&gt;print "Please enter a word from the letters above: "; 
chomp(my $word = &lt;STDIN&gt;); #INPUT WORD 


if ($word =~ /[$random_string]$/i) { 
print "Good word\n"; 

last; 
} 
else { 
print "try again\n"; 
print "\n"; 
} 
&lt;/code&gt;</field>
</data>
</node>
