Term::Size is a Perl module which provides a straightforward way to retrieve the terminal size.

Both functions take an optional filehandle argument, which defaults to *STDIN{IO}. They both return a list of two values, which are the current width and height, respectively, of the terminal associated with the specified filehandle.

In a scalar context, both functions return the first element of the list, that is, the terminal width.

The functions may be imported.

If you need to pass a filehandle to either of the Term::Size functions, beware that the *STDOUT{IO} syntax is only supported in Perl 5.004 and later. If you have an earlier version of Perl, or are interested in backwards compatibility, use *STDOUT instead.

To be true, you don't need a Win32 machine to run this module.
You need a working B<Win32::Console>. Of course, it is
easier if you are in Win32.

If the terminal size information is not available, the functions will normally return (0, 0), but this depends on your system. On character only terminals, pixels will normally return (0, 0). To be true, in Win32, it always return (0, 0).