hasdata import hasdata; if (stdin.hasData) // works with console input, pipes & files writeln("Has Data!");