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;