in reply to Re^2: Printing to a File from Sub
in thread Printing to a File from Sub
You should either use
oropen my $fhout, '>', "./test_out.file" or die "$!";
. The code you posted is parsed asopen (my $fhout, '>', "./test_out.file") || die "$!";
which is definitely not what you want.open (my $fhout, '>', ("./test_out.file" || die "$!"));
To avoid the error you reported, though, use
ormy ($fhout) = @_;
Also note that the ampersand sign & is not needed when calling a sub (see perlsub).my $fhout = shift;
In Section
Seekers of Perl Wisdom