while (<>) { # do something with $_ } #### # cat myfile.txt | dosomething.pl #### # dosomething.pl < myfile.txt #### #dosomething.pl myfile.txt