|Don't ask to ask, just ask|
Placement of $~ or $FORMAT_NAMEby loris (Hermit)
|on May 13, 2011 at 12:50 UTC||Need Help??|
loris has asked for the
wisdom of the Perl Monks concerning the following question:
I know I should be using Perl6::Form and not struggling with Perl5 formats, but bear with me.
I want to print something formatted to the terminal or to a file. This is what I came up with:
The code above produces the error
Undefined format "$fh" called at ./test.pl line 32.
if called with ./test.pl -f. If I uncomment the line before the write(), the data is written to the file.
Why is this and is there a better idiom for switching between filehandles when using formats?