In Perl, how to print a string as a line to STDOUT? That is, the string and the newline character, nicely?
And similarly, how to print the line to STDERR?
In Perl, to nicely print a new line to STDOUT, you can use the “say” feature which “Just like print, but implicitly appends a newline”:
use 5.010; say "hello world!"
$ perl -de1 main::(-e:1): 1 DB<1> use 5.010; DB<2> say "hello world" hello world DB<3>
In Perl, to print to STDERR, you can
STDERR which is the STDERR:
say STDERR "your message here"
$ perl -de1 main::(-e:1): 1 DB<1> use 5.010; DB<2> say STDERR "hello world"; hello world DB<3>