Determine the height and width of the terminal, and store this information into variables for subsequent use.

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