I don't see how remembering the last line becomes "increasingly ugly":
use strict; my @lines = map { [split /,/] } split /\s+/, <<CSV; Desk,Left-Drawer,Paperclips Desk,Left-Drawer,Pens Desk,Right-Drawer,Ruler Filing-Cabinet,Top-Drawer,Files CSV my @last_line; for my $line (@lines) { my $i = 0; $i++ while $line->[ $i ] eq $last_line[ $i ]; # Now, empty out the elements we don't want to output again # and copy over the rest of @$line my @output = (('') x $i, @{$line}[$i..$#$line]); # Output through table module of your choice print join "|", map {sprintf "%-20s",$_} @output; print "\n"; @last_line = @$line; };
The uglyness stays the same no matter what your column count is.
In reply to Re: Pretty-Print Table (Omitting Duplicates)
by Corion
in thread Pretty-Print Table (Omitting Duplicates)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |