Look at the sprintf function. Please!

> #  while ( $data ) = $sth->fetchrow()) {
>     $l = length( $Site );
>     if( $l != 5 ) {
>       $s = substr( "            ", 0, 5 - $l );
>       $Site .= $s;
>     }

Does this do what you want?

$Site = sprintf '%-5s', $Site;

One liner:

C:\>perl -e"$Site = q(Foo); $Site = sprintf q(%-5s), $Site; print
qq('$Site'\n)"
'Foo  '

Luke

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to