Yes, that's what Rob said and I know the range operator in general, but I just cannot 
find some principled explanation or hint to this behaviour in "Programming Perl". Did 
you discover it by accident?

- Jan

Tim wrote:

>This is an example of the range operator '..' , which works with
>operands on either side. In a scalar context, if either operand is a
>numeric literal, it is compared to $. , which contains the current
>line number of the input file.
>
>e.g.   next if (5 .. /^Foo/);   #  skips lines 5 up to first line
>starting with Foo
>
>At 08:19 PM 1/29/04 +0100, you wrote:
>
>>Rob Dixon wrote:
>>
>>>Jeff 'Japhy' Pinyan wrote:
>>>>
>>>>while (<FILE>) { print "small " if 1 .. 10; print "medium " if 6
>>>>.. 15; print "big " if 11 .. 20; print "\n";
>>>>}
>>>
>>>Careful here Jeff. '..' compares its operands with $. (current
>>>record number) in a scalar context.
>>>
>>Hm. Why doesn't it operate on $_ like /regex/?
>>
>>- Jan -- There's no place like ~/
>>
>>-- To unsubscribe, e-mail: [EMAIL PROTECTED] For
>>additional commands, e-mail: [EMAIL PROTECTED]
>><http://learn.perl.org/> <http://learn.perl.org/first-response>
>
-- 
These are my principles and if you don't like them... well, I have others. - Groucho 
Marx

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to