in reply to Dynamically build a table
Update A possible change of code to fit Deep_Plaid's followup question.
Produces output:#!/usr/bin/perl use strict; use warnings; use Text::Table; my $file = "1.00 InDev 01-Jun-2013 1.00 InTest 15-Jul-2013 1.00 InUAT 31-Jul-2013 1.00 InProd 15-Sep-2013 1.01 InDev 01-Jul-2013 2.00 InDev 01-Aug-2013 3.00 InDev 01-Sep-2013"; open my $fh, '<', \$file; my %line; while (<$fh>) { my ($ver, $status, $date) = split; $line{ $ver }{ $status } = $date; } my @status = qw/ InDev InTest InUAT InProd /; my @module = (undef, qw/ IXR Reports Three /); my $tb = Text::Table->new( "Module", "Version", @status ); for my $ver (sort keys %line) { my ($i) = $ver =~ /(\d+)/; $tb->load([ $module[$i], $ver, map $_ // 'N/A', @{$line{$ver}}{ @s +tatus } ]); } print $tb;
Module Version InDev InTest InUAT InProd IXR 1.00 01-Jun-2013 15-Jul-2013 31-Jul-2013 15-Sep-2013 IXR 1.01 01-Jul-2013 N/A N/A N/A Reports 2.00 01-Aug-2013 N/A N/A N/A Three 3.00 01-Sep-2013 N/A N/A N/A
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamically build a table
by Deep_Plaid (Acolyte) on Mar 14, 2014 at 15:28 UTC |