Thanks, the latter one works for me. Appreciate all the help. "Chas. Owens" <[EMAIL PROTECTED]> wrote: On Wed, Mar 26, 2008 at 12:32 PM, Bobby wrote: > Chas, > > Thanks for all your pointers. I guess i should read a Perl book first before > attempting to write codes in it :). I'm learning the hard way but making > small progresses. I was using what little knowledge i have and duck taped my > way around the problem. Maybe one day i will get this Perl thing down, look > back and laugh at this. > > I got one more issue with this script that i don't know how to resolve yet, > hopefully one of you could help me out. Using Chas's code: > > > $strA =~ s/,([^,]+)/,(AND($strLevel:$1))/g; > > which produces > > a,(AND(PSC_L0:b)),(AND(PSC_L0:c)),(AND(PSC_L0:d)) > > How do i put the (AND(PSC_L0:a)), for the first character in the $PSC_L0 > var? Right now the regex is substituting the text after the comma. > > Current out put: > a,(AND(PSC_L0:b)),(AND(PSC_L0:c)),(AND(PSC_L0:d)) > > Desired output: > (AND(PSC_L0:a)), (AND(PSC_L0:b)),(AND(PSC_L0:c)),(AND(PSC_L0:d)) snip
$strA =~ s/([^,]+)/(AND($strLevel:$1))/g; or possibly $strA =~ s/([^,]+)/(AND($strLevel:$1))/g if $strA =~ /,/; If you don't want lines that have no commas to be affected. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.