use scoped variables instead of bareword filehandles