Also, "Mastering Regular EXpressions" - Orielly book gives real nice insight about this.
I'm still learning PERL...Sigh! ~A On Fri, 29 Oct 2004, Gunnar Hjalmarsson wrote: > [EMAIL PROTECTED] wrote: > > 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"; > > } > > } > > > > I have initialised $_ with the string in which I have to search. Now I > > know that the while loop will read each and every character in the > > string. I just need to get that character read to make the comparison. I > > know $1 doesnt work because it is not :) Where is the value returned or > > how can I assign a variable the value of the condition in the while loop ? > > As Ajey showed, $1 does work provided that you use capturing > parentheses, or you can use $& (but read the warning in "perldoc perlre" > if you consider the latter). > > -- > Gunnar Hjalmarsson > Email: http://www.gunnar.cc/cgi-bin/contact.pl > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>