On Thu, Aug 27, 2009 at 2:36 PM, Mark J. Reed<[email protected]> wrote:
> I think $a <= $^x <= $b is short enough, and lets you choose between <
> and <= on both ends and without having to remember how many dots each
> maps to.
"How many dots"?
Note that there are three sets of comparison operators:
'<' and '<=' numify their arguments before comparing them.
'lt' and 'le' stringify their arguments before comparing them.
'before' compares its arguments without any coercion. Note that
there's no equivalent to '<='.
I'm unclear as to which of these cases '..' is currently like, if any;
it may be an unholy hybrid of all three. But for the sake of
argument, I'll assume that it's currently like '<' and '<='.
$a ~~ 1..5 # $a ~~ 1 <= $_ <= 5
$a ~~ 1^..5 # $a ~~ 1 < $_ <= 5
$a ~~ 1..^5 # $a ~~ 1 <= $_ < 5
$a ~~ 1^..^5 # $a ~~ 1 < $_ < 5
What's so hard about that? And if '..' is like 'before', it can do
things that can't easily be done otherwise:
$a ~~ 1..5 # 1 before $_ before 5 || $_ === 1 | 5
--
Jonathan "Dataweaver" Lang