On Mon, Sep 24, 2001 at 11:35:19AM +0200, Paul Johnson wrote:
> On Mon, Sep 24, 2001 at 01:15:06AM -0400, David H. Adler wrote:
>
> > On the other hand, given the wording of this, I find this slightly
> > odd:
> >
> > bash-2.05$ perl -e ' $i = (-3..0);print "*$i*\n"'
> > **
> >
> > ...as the right operand is false.
> >
> > Or am I misreading this?
>
> I think that what you are missing is that .. compares its constant
> operands to $. Thus it is only really useful within an input loop and
> with numbers which can match $.
>
> In this case $. != -3 so $i is false.
In that case, why does (0..4) return a false value? The comparison of 0
to $. is true, so the range op becomes true. According to the
documentation, it shouldn't become false again until the right operand
compares true to $. - which it doesn't. If it's the case that it
compares to $. on the left but takes the truth value of the left operand
itself, that strikes me as screwy.
Again, am I missing something?
dha
--
David H. Adler - <[EMAIL PROTECTED]> - http://www.panix.com/~dha/
Sturgeon's Law: 90% of everything is crap.
Cassell's Corollary: Sturgeon would have upped that number if he'd
seen the Internet.