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 @_; } }