Since print is a list operator, saying
print '.', next if ...
is like saying
print('.', next) if ..., first calling next and
passing it's return value as part of the arguments to print. But next
never returns, so the print never happens.
print('.'), next if ... or (print '.'), next if ... make
it work as you intend.
Hmm, should next in non-void context warn?