http://www.perlmonks.org?node_id=10957


in reply to How do you simulate the use of the keyboard ?

If you prefer not changing your filehandle, you can also cat (or perhaps echo, if you're stuck in Windows land) a file into your script:
#!/usr/bin/perl -w use strict; print while (<STDIN>);
Invoke it like this: cat printline.pl | ./printline.pl This trick works really really well for debugging CGI.pm applications from the command line.