In the past my vrml scripts have always generated one set of VRML statements written to STDOUT on a given run, but in this latest script I wanted to create two wrl files in DrillPressTable.pl:
my $LumberFile="$Dir/$Subdir/lumber.wrl"; my $DrillPressTableFile="$Dir/$Subdir/$Subdir.wrl"; &mystart($LumberFile,LF); &buildlumber(\%Fs,LF,$Ppi); &mystart($DrillPressTableFile,DP); &buildtable(\%Fs,DP,$Ppi);
The original printout subroutine in VRML.pm looked like this, which I couldn't now use in DrillPressTableFile.pl because it had no provision for directing output to a filehandle other that STDOUT:
<code> sub printout { my($lines)=@_; foreach my $line (@{$lines}) { print "$line\n"; } } # End printout; </code)The suggestion by Mr. Marshall didn't work, because the problem occurs when $fh at entry to printout is defined. Setting $fh to STDOUT is to have a default, and perhaps that would've been a problem if I'd gotten past the original problem of passing a filehandle to printout.
The myprint subroutine was to be only temporary until I figured out how to change printout to accept a filehandle, which brings me to my original question: How do I declare $fh in subroutine printout so it recognizes the intended filehandle?
In reply to Re^2: Filehandle in subroutine in use VRML.pm
by smittypaddler
in thread Filehandle in subroutine in use VRML.pm
by smittypaddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |