in reply to Filehandle in subroutine in use VRML.pm
This is not right: $fh=STDOUT unless($fh); Try this instead:
use strict; # always enable all strictures use warnings; my @lines = ("asdf", "xyz"); printout (\@lines); # # Default to STDOUT if no file handle specified # sub printout { my($line_ref,$fh)=@_; $fh= *STDOUT unless ($fh); # *STDOUT is a typeglob foreach my $line (@{$line_ref}) { print $fh "$line\n"; } } # End printout;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Filehandle in subroutine in use VRML.pm
by smittypaddler (Acolyte) on Jul 07, 2022 at 12:43 UTC | |
by haukex (Archbishop) on Jul 07, 2022 at 20:10 UTC | |
by Marshall (Canon) on Jul 11, 2022 at 20:58 UTC | |
by bliako (Abbot) on Jul 12, 2022 at 12:03 UTC |