I want to output a progress bar, but how do I retrieve the terminal width in Perl?
A core Perl solution would be preferred, since I don’t have access to a compiler, just an already installed 5.8.2 Perl.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The FAQ which ships with Perl has the answer to this question. If you run
perldoc -q "screen size", you’ll get the following:So you can use the last one if you want a pure Perl solution, or install Term::ReadKey from CPAN if you want a simpler solution in your code but more up-front set-up.