[EMAIL PROTECTED] wrote: > Hi All, > I have to write a code wherein I have to access each character in a > string and compare it with '-' > > $_ = $seq1[0]; > while(/./g) { > if($1 eq '-') { > $res1[0] .= '-'; > } > else { > $res1[0] = "A";
Do you mean .= here? > } > } Are you trying to change all the non-dash chars to "A"? Why not something like: $res1[0] = do { local $_ = $seq1[0]; s/[^-]/A/g; $_ }; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>