$line2 = capture_stdout($line) ; ... sub capture_stdout() { ... }