Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

formatting output to align properly

Posted on 2011-04-22
4
Medium Priority
?
343 Views
Last Modified: 2012-05-11
I have to print something like this

Name   ID     Details
-----      ------    ---------
ambuli  25        StreetName,
                        Address,
                        City
some    30        someStreet,
                        someAddress,
                        someCity
That is, the third column would have multiple lines, and I should arrange the column properly.  Thanks.
 
0
Comment
Question by:ambuli
  • 2
  • 2
4 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35451829
If the above is the output what is the input?
0
 

Author Comment

by:ambuli
ID: 35451843
Assuming that the names, and addresses, etc are available within a program in some data structures.  I am working on a slightly large program and it would be confusing to look at the whole code :-)
0
 
LVL 31

Accepted Solution

by:
farzanj earned 2000 total points
ID: 35451859
Why don't you simply using C-style printf.  It works in Perl.

Suppose you want to print a string in 10 character spaces the you print it as

printf("%10s", $name);



0
 

Author Comment

by:ambuli
ID: 35451878
oh, I did not know it.  Thanks.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

564 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