in reply to How to get the width of a console window?

Any method you choose will be dependent on the terminal you're using. The Perl Cookbook, Recipe 4.18, "words program" offers a simplistic scrap of code for Linux. It would not work on Windows. It asks for extended information on the given filehandle, which the terminal program itself generally provides.
# not portable -- linux only sub getwinsize { my $winsize = "\0" x 8; my $TIOCGWINSZ = 0x40087468; if (ioctl(STDOUT, $TIOCGWINSZ, $winsize)) { ($rows, $cols, $xpixel, $ypixel) = unpack('S4', $winsize); } else { $cols = 80; } }

You might do some research into termcap, which is the usual way of figuring out terminal capabilities and escape code sequences supported on a given Unix-style terminal. There are some CPAN modules which interface with the termcap facility.

--
[ e d @ h a l l e y . c c ]