Arrrgh!
yeah, i get that ;-)
I0 wrote some nasty looking line noise. i found it frighteningly logical. that code shows I0 knows perlop. i took the time to translate this to English, but it doesn't make it much clearer. why? because the secret is in the range operator.
from perlop:
Range Operators
Binary ".." is the range operator, which is really two different operators depending on the context. In list context, it returns an array of values counting (up by ones) from the left value to the right value. If the left value is greater than the right value then it returns the empty array. The range operator is useful for writing foreach (1..10) loops and for doing slice operations on arrays.
therefore:
( ( $INPUT_LINE_NUMBER or ONE ) ..
( $INPUT_LINE_NUMBER and ZERO ) )
is the range operator returning in list context. it's operating on some number >=1, to 0. it returns the empty array -- with length of the left number. subtract one to make it zero-based indexing (and to put it in scalar context,) and you've got your counter. {evil grin}
try:
perl -le "print( ($.||1..undef)-1 )for 1..4"
for a (somewhat) less obscure but equivalent obfuscation.
i hope that helps a little. mmm... dark magic.
~Particle *accelerates*
| [reply] [Watch: Dir/Any] [d/l] [select] |
($. || 1 .. undef) -1 totally baffles me. This must be an obscure effect. I read this as a scalar use of the range operator with start and stop conditions but you say that it's in list context instead.
I can reduce this to:
((undef or 1) .. undef) - 1
but no more.
Can you shed more light on what anonymous variable is keeping count?
metadoktor
"The doktor is in."
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |