print scalar split /\n/ for "1\n2\n3\n\n"; # Prints 3 instead of 4