Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Formatting Output

by toolic (Bishop)
on Oct 11, 2012 at 17:36 UTC ( #998495=note: print w/replies, xml ) Need Help??


in reply to Formatting Output

If you know ahead of time how wide each column is, use printf. If you want your columns to be auto-scaled for you, you can use a module like Text::Table.

Replies are listed 'Best First'.
Re^2: Formatting Output
by frozenwithjoy (Priest) on Oct 11, 2012 at 18:02 UTC
    I was just about to suggest Text::Table, too. I love how you can have columns aligned by arbitrary characters (e.g., the decimal in a number). The only drawback is if you want to open your output in Excel or something, the columns don't get split as easily as if it were tab-delimited, etc.

      If you're going to be using Excel, why do you care what the bare output looks like?

        There have been times when I've generated tables that I like to examine using less, but others might need to open in Excel for their own reasons.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998495]
help
Chatterbox?
[Lady_Aleena]: paco is a little over 2 years before my time.
[Discipulus]: you can try tachyon's iterative approach Re: Win32 Recursive Directory Listing
[Lady_Aleena]: I'm on Linux/
[beech]: isn't 2 year about standard recovery time for that kind of surgery?
[Discipulus]: if you hate FIle::Find
[Lady_Aleena]: I don't hate it, it just drives me crazy.
[Discipulus]: LA the solution is portable to whatever
[Lady_Aleena]: File::Find doesn't have a simple sub wanted example, like get the name of the file.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2017-04-23 20:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.