use Term::ReadKey; sub line_msg { my $msg = shift; my ($width) = GetTerminalSize(STDOUT); print '-'x$width, $^O eq 'MSWin32' ? '' : "\n", "$msg\n"; }