exec "$0 $rfile $afile" unless @ARGV; while (<>) { # Do whatever you want here. }