sub func { print("in func\n"); } print("pre func\n"); { # Temporarily undefine STDOUT. local *STDOUT; func(); } print("post func\n");