nmerriweather has asked for the wisdom of the Perl Monks concerning the following question:
which was great! because for my formatting needs, formline() seemed to be even better than format -- my desire was to loop through an array, and format each element into the line style -- a 60col wide line with centered text and | at each site
example: | centered text line! |
learning formline though, my code ended up as something like:
$^A = ''; $printIt = "+-----------------------+\n"; foreach $line (@lines){ formline("| \@|||||||||||||||||||| |\n",$line); } $printIt .= $^A; $printIt .= "+-----------------------+\n";
without the line "$^A = '';", running this again (its in a subroutine) churns out the last time's results
this seems kind of... messy... to me
is there a better way?
can i do this without nullifying $^A?
is it possible to do this (center, left/right justify text) with sprintf instead?
advice?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sprintf vs formline
by Zaxo (Archbishop) on Sep 03, 2002 at 03:56 UTC | |
by nmerriweather (Friar) on Sep 03, 2002 at 04:09 UTC | |
by demerphq (Chancellor) on Sep 03, 2002 at 11:35 UTC | |
|
Re: sprintf vs formline
by Aristotle (Chancellor) on Sep 03, 2002 at 14:00 UTC |