http://qs321.pair.com?node_id=1094513


in reply to Is it possible to write to STDIN ?

$ foo | bar

'bar's STDIN is whatever 'foo' spits to STDOUT. So if you can control how your code is executed from the shell, you can control its STDIN. For example ...

for i in `seq 1 10`; do echo $i|./myscript.pl; done
will execute your script ten times, each time with a different number on its STDIN.