Searched for tag terminal and found 1 results in 0.4 ms

Perl: Get terminal width

If you need a fast and simple way to get the terminal width in Perl core use Term::ReadKey. This is almost certainly faster and better than shelling out to tput cols.

sub get_terminal_width {
    my @x      = Term::ReadKey::GetTerminalSize();
    my $width  = $x[0] || 0;

    return $width;
}
Tags:
Leave A Reply