in reply to Can a filehandle name be dynamic?
ELISHEVA has already shown you the way, but it's worth commenting on some of the important style elements in Beth's code.
First off, note that she uses strictures (use strict; use warnings;) - you should always use strictures!
Note too that Beth uses the three parameter version of open and that she checks the result. Always use the three parameter version of open. Not so obvious because of the nature of the question is that a lexical variable is being used for the file handle - always use lexical variables and declare them in the smallest scope possible.
|
|---|