# old STDIN: 1 2 3 while () { if (some condition) unshift "hi test test" to STDIN # new STDIN hi test test 1 2 3 } #### while () { if (some condition) $_ = "hi test test " . $_; # ... } #### # supposing that @ARGV contains file name(s) to be filtered and processed: open( INP, "my_filter_script.pl @ARGV |" ) or die "can't filter: $!"; while () { # prefixes and other source code filtering are already done # ... }