When addressing portability issues, it is usually an idea to check the value of $^O, which translates to $OSNAME if you use English. You can also get the terminal width using Term::Readkey and call the method GetTerminalSize. Note also that windows counts the characters and wraps irrespective of whether the characters are even visible.
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 @_;
}
}