in reply to Re^2: blank lines up to a point
in thread blank lines up to a point

I get an error from this unless I alter the tell line to my $discard=tell(STDIN); then indeed it gives the advertised output (I am on an old perl version here, client requirements)

./flipflop Useless use of tell in void context at ./flipflop line 14. perl -v This is perl, version 5.005_03 built for sun4-solaris ...after the above edit.... root@tivpre-master:/home/robinp # ./fixedflop flipflipflipflop

that aside how does this work ? the docco says tell normaly returns -1 against STDIN, what dark juju is going on to make 0 true and what else could I use that I can trust never to be true ?

Updated

It took some digging but I've got it now. the binary range operator .. will compare a given constant value to the value of the current input line number $. (actualy int(EXPR)==int($.) I was naively using 0 in its meaning of false and you cunningly reset $. to 0 (with tell(STDIN)) so 0 got matched. I offer up a fixed sub to avoid this gotcha.
sub logit { local $.=1; my $line = shift @_; $line =~ s/\0//g; return unless (/\S/..0); print $line }

Many Thanks,
R.