Range comparisons are practically unknown among programming languages. As far as I know, Perl 6 will be the first widely used language to allow range checking.
Older languages use the excuse of implementation to forbid something which is a natural mathematical statement. Comparisons like < return a boolean value, a truth value: Is 9 less than $X? yes or no?. Languages such as C would then use the result of that comprison in stage two: Is (9<$X) less than 100?. Obviously unlikely to be what you want, so Perl detects and reports the error.
By optimizing your comparisons a little, you can eliminate the need for range testing:
if ( $X < 0 ) { handle_X_under_0(); } elsif ( $x < 10 ) { $Y = $X + 2000; } elsif ( $X < 100 ) { $Y = $X + 1900; } else { handle_X_over_100(); }
--
TTTATCGGTCGTTATATAGATGTTTGCA
In reply to Re: Syntax error - beginner question
by TomDLux
in thread Syntax error - beginner question
by ctp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |