my @out = `errorlevel.cmd perl -le"print for 1 .. 10; exit 12345;"`;; print pop @out;; 12345 print join '', @out;; 1 2 3 4 5 6 7 8 9 10