Read the terminal size with Perl

Two modules will give you the info you want:

use Term::ReadKey;
my ($cols,$rows) = GetTerminalSize();
use Term::Screen;
my $cols = cols();
my $rows = rows();

Or shell out and get it

my ($rows,$cols) = split(/ /,`/bin/stty size`);
Leave A Reply
All content licensed under the Creative Commons License