in reply to Filehandle in subroutine in use VRML.pm
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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Filehandle in subroutine in use VRML.pm
by smittypaddler (Acolyte) on Jul 17, 2022 at 21:06 UTC | |
by haukex (Archbishop) on Jul 18, 2022 at 07:13 UTC | |
by BillKSmith (Monsignor) on Jul 20, 2022 at 19:34 UTC |