?
Solved

format output

Posted on 2005-03-21
1
Medium Priority
?
229 Views
Last Modified: 2010-03-05
i have a cgi script with the print statement:

print "$a $b $c $d $e <br>";
how do i format this so that they can seem to appear in same column

i want 26 space for $a, 26 for $b, 5 for $c, 5 for $d, 5 for $e.


example) right now the output is like:
rahulshah temp 3 4 5
shailendramaheswar jamnshfkf 4 5 6

what i want is:


rahulshah                  temp                    3     4     5
shailendramaheswar   jamnshfkf             4     5     6
0
Comment
Question by:shahrahulb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 13594220
($_ = sprintf"%26s%26s%5s%5s%5s<br>",$a,$b,$c,$d,$e) =~ s/ /&nbsp;/g;
print;
#or
printf"<pre>%26s%26s%5s%5s%5s\n</pre>",$a,$b,$c,$d,$e;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question