in reply to How to select a file handle depending on user options

You assign strings 'FILE' and 'STDIN' instead of handles. Use
$HANDLE = *FILE; ... $HANDLE = *STDIN;
Update: or use \*FILE for a reference.

See Typeglobs and Filehandles.