in reply to Find Comma in a string

And just to be safe, why are you looking for the positions of the commas? Depending on what you are trying to do with that info there may be a better way to do it avaoiding this step.

-Waswas

Replies are listed 'Best First'.
Re: Re: Find Comma in a string
by cshields36 (Initiate) on Jun 26, 2003 at 18:54 UTC
    What I really needs I have user credentials in a older system in jdoe,dept,comp and I need it in fully distiguisded to manipulate using ldap like cn=jdoe,ou=dept,o=comp.
      $input_string = "jdoe,dept,comp\n"; chomp $input_string; ($cn_temp, $ou_temp, $o_temp) = split /,/ , $input_string; print "cn=$cn_temp,ou=$ou_temp,o=$o_temp\n";
      will print "cn=jdoe,ou=dept,o=comp" -- Perl has many wonderful string tools, you dont have to do it like C. =)

      -Waswas