if (eval("$cond1 $AND_operator $cond2")) is this correct?
-----Original Message----- From: Khairul Azmi [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 25 de Outubro de 2004 11:00 To: [EMAIL PROTECTED] Subject: Re: assign operator as variable Actually I am looking for an alternative to replace the conventional symbol "&&" with other variable eg $AND_operator so that the following statement is valid if ($cond1 $AND_operator $cond2) Thanks On Mon, 25 Oct 2004 10:44:19 +0100, Marcos Rebelo <[EMAIL PROTECTED]> wrote: > Maybe this can help > > $a = "1 or 0"; print eval($a); > > > > -----Original Message----- > From: Khairul Azmi [mailto:[EMAIL PROTECTED] > Sent: segunda-feira, 25 de Outubro de 2004 10:40 > To: [EMAIL PROTECTED] > Subject: assign operator as variable > > I am not sure what category should this question fall under but this > is what I plan to do. > > $cond1 = 1; > $cont2 = 0; > $oper1="&&"; # for AND > $oper2="||"; # for OR > > if ($cond1 $oper1 $cond2) { > print "one \n"; > } else { > print "two \n"; > } > > The statement above would generates errors. Can somebody tell me how > to do it in proper way. Thanks > > Azmi > > -- > 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> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>