BEGIN { pipe local (*IN, *OUT); while (<STDIN>) { print OUT; # do what you need to with $_ } close OUT; open STDIN, "<&IN"; } use CGI; [download]
This hangs if the data on STDIN is bigger than your system's pipe buffer, so I wouldn't recommend it.