Apologies for what I'm sure is a very simple question, but here goes.
How can I print a message to the console if I have a command line parameter to write to file? Here's what I have on the command line:
script.pl > outputFile.txt
And then, in the script
do_something(); # Prints output to file
print ("Done something."); # How can I make this print to the console?
I have a feeling I should be using a different method of printing the output of do_something(); to the file, but if possible I'd like to leave the file specified as a parameter on the command line.
Print to STDERR
print STDERR "message\n";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With