[EMAIL PROTECTED] am Montag, 26. Februar 2007 18:49:
[snip]
Hi!
> use strict;
> use warnings;
>
> my $rdns="cn=Exchange Sites,cn=Proxy Views,cn=JoinEngine
> Configuration,ou=Conf,o u=InJoin,ou=applications,dc=marriott,dc=com";
>
> my $result="cn=Exchange Sites";
>
> if ($result !~ /\Q$rdns\E/six) {
> print "\nresult: '$result'";
> print "\nrdn: '$rdns'\n";
> } else {
> print "String is there\n";
> }
> OUTPUT is:
> $ ./test.pl
> result: 'cn=Exchange Sites'
> rdn: 'cn=Exchange Sites,cn=Proxy Views,cn=JoinEngine
> Configuration,ou=Conf,ou=InJoin,ou=applications,dc=marriott,dc=com'
>
> Tom your code works fine. But I was tring to understand why "!~" fails
> above.
[snip]
The regex expression tries to match $rdns in $result, and not the reverse way,
and of course you can't find a long string in a shorter one, even not if the
shorter one is contained in the longer one.
So $rdns is never matched in $result, and since you ask if it does *not*
match, the result is always true, and the else branch is never hit.
Dani
P.S.:
Please open a new thread when asking a new question, and answer inline or at
the bottom, not a the top, thx :-)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/