That might help a little with showing you what i wanna do...alternate between font colors. if you know a better way, please inform me :)foreach $name (@excer) { if ($1 / 2) { print '<FONT color="Yellow" face="Times New Roman">', $name, '</FONT><BR>'; } else { print '<FONT color="#ccffff" face="Times New Roman">', $name, '</FONT><BR>'; } $i++; }
Edited by davido: Reformatted code section, even though it has nothing to do with the actual question of "How do I test if a number is negative or positive."
| Answer: how do i test a number negative or positive? contributed by Kanji For your original question, comparing with the abs value should do the trick ...
... but for your revised question, you should check the modulus ...
However, if all you really want to do is alternate colours... Edit by dws per author's request |
| Answer: how do i test a number negative or positive? contributed by PodMaster check out perlsyn and perlop (in particular the comparison operators)
|
Please (register and) log in if you wish to add an answer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |