Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Report Formatting Help

by TilRMan (Friar)
on Jul 14, 2004 at 03:01 UTC ( #374202=note: print w/ replies, xml ) Need Help??


in reply to Report Formatting Help

#!/usr/bin/perl -w use strict; use Text::Table; my %data; while (<>) { my ( $rep, $product, $foo ) = split ' '; $data{$rep}{$product} = $foo; } my @reps = sort keys %data; my $table = Text::Table->new( '', @reps ); for my $i ( 0 .. $#reps ) { my $rep = $reps[$i]; my @products = sort keys %{ $data{$rep} }; foreach (@products) { $table->add( $_, ('') x $i, $data{$rep}{$_} ); } } print $table;

BTW, having never used Text::Table before, I found it surprisingly powerful. Most of that power is unused on this program.


Comment on Re: Report Formatting Help
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://374202]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-12-28 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls