$wc += split; within the while loop will do it. That's another case of default arguments.
After Compline,Zaxo
In reply to Re^3: calculating lines by Zaxo in thread calculating lines by Yoda_Oz