in reply to [OT] Why does newline in Windows print as having width?
use Term::ReadKey; use English qw( -no_match_vars ); sub Print { if ( $OSNAME =~ /^MSWin/) my ($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize()); # nb in this case, in above only need the first var # but keep the brackets for my $chunk (@_) { chomp $chunk; for my $line (split /\n/, $chunk) { print $line . (length($line) == $wchar ? '' : "\n"); } } } else { print @_; } }
One world, one people
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: [OT] Why does newline in Windows print as having width?
by Anonymous Monk on Aug 20, 2018 at 10:14 UTC | |
by anonymized user 468275 (Curate) on Aug 20, 2018 at 13:47 UTC |