in reply to Re: Better way to search array for elements in other array?
in thread Better way to search array for elements in other array?
First, you should use > instead of ge when dealing with numerical values
Well, ">=" would be the numerical equivalent to the string comparison operator "ge", so index(...) >= 0 would be perfectly fine.
The reason the string comparison operators are not suitable for numerical comparisons is that they don't use different rules than the numerical comparison operators.
$ perl -E'say 2 >= 10 ? 1 :0' 0 $ perl -E'say 2 ge 10 ? 1 :0' 1 # Because 2 ge 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Better way to search array for elements in other array?
by Limbic~Region (Chancellor) on Jan 24, 2011 at 21:30 UTC | |
by ikegami (Patriarch) on Jan 24, 2011 at 23:07 UTC | |
by Limbic~Region (Chancellor) on Jan 24, 2011 at 23:23 UTC | |
by ikegami (Patriarch) on Jan 25, 2011 at 04:10 UTC |