Hello,

> I commonly make use of statements like:     print OUTFILE "Print
> results, data, or anything else\n";
> This is normally preceded by defining my file handle, as in something
> like:     open(OUTFILE, ">newfile.txt");
>
> Or does print (or printf for that matter) recognize that no such
> filehandle exists and quit?

it doesnt 'quit' if you mean by that exit the program or cause an error...
if you run under -w it will tell you you might have made a mistake by not
opening the filehandle... you could do a check if it's open of course but
that's not what you want most likely

> As part of a program I'm writing, I would prefer that it quit if the
> filehandle is undefined.  I want the user to specify between 2 levels
> output verbosity,

you can make an easy check for that if you like:

my $debug = 1; (or '' if you want to turn muy verbose off)

and with that you can build in statements like this:

$debug && print "extra verbose msg!";

this will only print if $debug has a value

Hope this helps,

Jos Boumans

Reply via email to