If FILEHANDLE is an undefined scalar variable (or array or hash element), a new filehandle is autovivified, meaning that the variable is assigned a reference to a newly allocated anonymous filehandle. Otherwise if FILEHANDLE is an expression, its value is the real filehandle. (This is considered a symbolic reference, so use strict "refs" should not be in effect.)
You initialize $fh with LF. Under strict, all three options produce the expected error:
Can't use string ("LF") as a symbol ref while "strict refs" in use ...The real question is why do options 0 and 1 appear to work as intended without strict. I have no idea.
The minimal (not recommended) 'fix' is to remove LF from the call to mystart. This leaves $fh uninitalized.
#&mystart($LumberFile,LF); &mystart($LumberFile);
In reply to Re: Filehandle in subroutine in use VRML.pm
by BillKSmith
in thread Filehandle in subroutine in use VRML.pm
by smittypaddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |