in reply to TIMTOWTDI Challenge: Open a file

I can mess with both files at once. :-)
system( "$^X -pl -e 's/foo/bar/g' $rfile $afile" );
Alternately, if I absolutely have to provide an explicit iteration over the file, I could
exec "$0 $rfile $afile" unless @ARGV; while (<>) { # Do whatever you want here. }

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?