in reply to [OT] Why does newline in Windows print as having width?
My question is why?When you have such questions about something that has been evolving since the beginning of computer era, the answer is most probably "backwards compatibility". I'm sorry for having no references to back that statement, though.
There is no easy solution because some users will happen to have terminals wider or narrower than 80 characters. If I were you, I would write a function to detect terminal width and print a horizontal line and the following message, like this:
use Term::ReadKey; sub line_msg { my $msg = shift; my ($width) = GetTerminalSize(STDOUT); print '-'x$width, $^O eq 'MSWin32' ? '' : "\n", "$msg\n"; }
|
---|