Thanks Paul. However I think I couldnot explain the problem. The issue is when I have mailid's as well as a part of input stream.
Input stream ---> $str="ldap:///uid=user1,ou=People,o=test.com,a...@test.com ,t...@test.com,r...@test.com,ldap:///uid=user2,ou=People,o=test.com ,ldap:///uid=user3,ou=People,o=test.com" current output =========== *first = uid=user1,ou=People,o=test.com <http://test.com>,a...@test.com <a...@test.com>,t...@test.com <t...@test.com>,r...@test.com <r...@test.com>* first = uid=user2,ou=People,o=test.com first = uid=user3,ou=People,o=test.com expected output ============ first=uid=user1,ou=People,o=test.com first=a...@test.com first=t...@test.com first=r...@test.com first = uid=user2,ou=People,o=test.com first = uid=user3,ou=People,o=test.com Regards, Punit