<?xml version="1.0" encoding="windows-1252"?>
<node id="1005411" title="Re: Regex to compare (if) two strings (Uniquely - I will explain inside)" created="2012-11-24 13:29:05" updated="2012-11-24 13:29:05">
<type id="11">
note</type>
<author id="965102">
Kenosis</author>
<data>
<field name="doctext">
&lt;p&gt;&lt;em&gt;Gotta validate the inputted word by checking that it indeed consists of the chars in $random_string.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Perhaps I'm misunderstanding you, but this sounds like you want to validate that the two sets of string characters are equal (the 'compare uniquely')--not that the two strings are equal.  If this is the case, the following is an option:&lt;/p&gt;
&lt;c&gt;
use strict;
use warnings;

my $word          = 'FHDJSKAL';
my $random_string = 'ALSKDJFH';

if ([sort ("\U$word" =~ /./g)] ~~ [sort ("\U$random_string" =~ /./g)]) {
	print "Good word.\n";
}
else {
	print "Try again.\n";
	print "\n";
}
&lt;/c&gt;
&lt;p&gt;Hope this helps!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Replaced the hash solution with one using the smart operator (&lt;c&gt;~~&lt;/c&gt;), as the former didn't match properly.</field>
<field name="root_node">
1005402</field>
<field name="parent_node">
1005402</field>
</data>
</node>
