in reply to Join a file piped to a perl script

open (MYFILE, "$argv[0]");

Unless this script is for controlled use, you might consider untainting $argv[0] before using it. Otherwise, you risk having a day ruined when some lamer passes    'rm -rf * |' as an argument.