in reply to Formatting screen output

If you know the screen width, you can use formats.
If you don't, you could get the width from Term::Screen.
Given the screen width in $width, centering a single line is easy:
sub centerlines { my $width = shift; print map { ' ' x int($width/2 - length($_)/2) . $_ } @_; } centerlines($width, 'These', 'lines', 'are', 'centered');

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re: Formatting screen output
by Anonymous Monk on Jan 09, 2002 at 02:27 UTC
    The Perl Term::Screen module seems like it would work perfectly, the only problem is that it doesn't come with my default Perl installation. I'm running Windows at the moment and have Activestate Perl installed. I tried downloading the Term::Screen module from CPAN, but the installation failed. Does anyone know of a way I can get this installed on a Windows Perl installation? Thanks in advance.