in reply to How to get the width of a console window?
# 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 ]
|
|---|