sub columns { my $result; # http://search.cpan.org/~kjalb/TermReadKey/ReadKey.pm # Term::ReadKey is not a standard Perl module, and may not be installed. If the user resizes the terminal # while the program is running, this will correctly reflect the resizing. eval 'use Term::ReadKey; my ($wchar, $hchar, $wpixels, $hpixels) = GetTerminalSize(); $result=$wchar'; # http://search.cpan.org/~nwclark/perl-5.8.8/lib/Term/ReadLine.pm # Term::ReadLine is a standard Perl module, but exists in different implementations under the hood. On a Linux # system, it's implemented using Term::ReadLine::Gnu, which supports get_screen_size(). On a default FreeBSD system, # however, the following won't work; you'd have to install the p5-ReadLine-Gnu package to get support for this function. if (!$result) { eval 'use Term::ReadLine; $term = new Term::ReadLine("foo"); my ($r,$c)= Term::ReadLine::get_screen_size(); $result=$c'; } return $result; }