use Term::Size;
($cols, $rows) = Term::Size::chars;
print "The terminal has $cols columns and $rows lines\n";