Hi all, I have a problem when print out my data in a table using Text:Diff. The below is my code:
use strict; use warnings; use Text::Diff; use List::Util qw( max ); my $a; ## The number of codec involes in mixed codecs. my $N; ## Channel capacity of mixed codec my $codecreference; ## declare codec for reference my ( $tmp, $total ) = ( 0, 0 ); print("Please input the number of codec that using "); $a = <STDIN>; my ( @codecs, @channelCap, @percentage ); ## declare codecs variabl +e for ( my $i = 0 ; $i < $a ; $i++ ) { print( "Codec " . ( $i + 1 ) . " = " ); $tmp = <STDIN>; push @codecs, $tmp; print( "Channel capacity of codec " . ( $i + 1 ) . " = " ); $tmp = <STDIN>; push @channelCap, $tmp; print( "Percentage of codec " . ( $i + 1 ) . " = " ); $tmp = <STDIN>; push @percentage, $tmp; } #### Print your input data #### print "No. Codec ChannelCap Percentage\n"; print diff \@codecs, \@channelCap, \@percentage, { STYLE => 'Table' };
--> Output:
Please input the number of codec that using 2 Codec 1 = 0 Channel capacity of codec 1 = 0 Percentage of codec 1 = 0 Codec 2 = 0 Channel capacity of codec 2 = 0 Percentage of codec 2 = 0 No. Codec ChannelCap Percentage Not a HASH reference at C:/Strawberry/perl/vendor/lib/Text/Diff.pm lin +e 46, <STDIN> line 7.
--> If I remove a element such as \@percentage, I can print. But this is not my expectation. I want to show many rows, columns. So, can anyone help me on this? Thanks so much.

2019-07-03 Athanasius promoted to root node; previously a reply to Text::Diff::Table output, but want to show all lines


In reply to Text::Diff::Table output, but want to show all lines by tctoa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.