One minor nuisance where warn+newline does not work the same as print+newline is when using CGI::Carp. Here's an example on my bash shell:
justin:~ $ perl -MCGI::Carp -e ' warn "Warning with newline\n"; carp "Carp with newline\n"; print STDERR "Print with newline\n"' [Thu Feb 26 17:53:00 2009] -e: Warning with newline [Thu Feb 26 17:53:00 2009] -e: Carp with newline [Thu Feb 26 17:53:00 2009] -e: at -e line 3 Print with newline justin:~ $
When I was trying to print some debugging messages using warn+newline the timestamps got a little spammy.
BTW, carp and croak will append the line number that called them even if you end the message with a newline, unlike warn and die.
In reply to Re: using warn instead or print STDERR?
by juster
in thread using warn instead or print STDERR?
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |