Nik has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, Is there any other better way to write the above code? Especially the print statements, because i noticed that allthough i try to leave spaces between the vars when i run the code they are only leave one space. Why? Is printf an alternative for that?if ($onoma eq 'showlog') { $st = $db->prepare( 'SELECT * FROM logger' ); $st->execute(); while ( $row = $st->fetchrow_hashref ) { print font( {-size=>4, -color=>'Lime'}, $row->{host}, " " +x(40-length($row->{$host})) ); print font( {-size=>4, -color=>'Cyan'}, "-> ", $ro +w->{xronos} ); print font( {-size=>4, -color=>'Yellow'}, " -> ", $ro +w->{game} ); print br(); } exit 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: spaces wont be displayed
by NetWallah (Canon) on May 24, 2004 at 22:43 UTC | |
by exussum0 (Vicar) on May 24, 2004 at 22:49 UTC | |
| |
by HollyKing (Pilgrim) on May 24, 2004 at 23:09 UTC | |
|
Re: spaces wont be displayed
by cLive ;-) (Prior) on May 25, 2004 at 00:31 UTC | |
| |
|
Re: spaces wont be displayed
by pbeckingham (Parson) on May 25, 2004 at 00:14 UTC | |
|
Re: spaces wont be displayed
by eclark (Scribe) on May 24, 2004 at 23:15 UTC | |
|
Re: spaces wont be displayed
by Abigail-II (Bishop) on May 25, 2004 at 09:53 UTC |