if (sysseek STDIN, 0, 1) { # run the optimized code } else { # run the slow code that stores data in memory instead of seeking back in the file }