On 2/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
All,
Hi. I have a problem with the below code. I have two strings, $rdns and
$result1. I want to make sure $result 1 is NOT part of $rdns. But the below
fails...thus instead of printing the else part of the if-else-loop. It print
the main part. Does anyone know what coudl cause this.
$rdns="cn=Exchange Sites,cn=Proxy Views,cn=JoinEngine
Configuration,ou=Conf,ou=InJoin,ou=applications,dc=marriott,dc=com
pwdChangedTime=20070101120000.000000Z";
$result1="Exchange";
if ($result !~ /$rdns/ix) {
print "\nresult: '$result'";
print "\nrdn: '$rdns'\n";
} else {
print "it is not there\n";
}
I think that you want to say that instead:
if ($rdns !~ /\Q$result1\E/ix) {
to make sure you can't find the contents of $result1 inside $rdns. You
may use the Perl built-in index as well, which will be even faster.
And don't forget to run your code under
use strict;
use warnings;
because your piece of code assigns to $result1 and test $result. That
would be obvious with strict and warnings.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/