Hi haukex, Thanks for your response. I want to write a perl scirpt with expectation below: - Input values from keyboard - Output those values in a tables (3 rows, 4 columns ) using Text:Diff:Table This is my code:

Input values from keyboard

$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; }
Assuming i = 3 There're 3 parameters need to input: type of codecs @codecs = (g711, g722, g729); @channelCap = (1000, 2000, 3000) ; @percentage = (0.5, 0.3, 0.2)

Output 4 columns: No. | Codec | ChannelCap | Percentage. Each parameter has corresponding values (here is 3). This is the number of row need to show.

print "No. Codec ChannelCap Percentage\n"; print diff \@codecs, \@channelCap, \@percentage, { STYLE => 'Table' };
Actually, I only get output bellow:
Please input the number of codec that using 3 Codec 1 = g711 Channel capacity of codec 1 = 1000 Percentage of codec 1 = 0.5 Codec 2 = g722 Channel capacity of codec 2 = 2000 Percentage of codec 2 = 0.3 Codec 3 = g729 Channel capacity of codec 3 = 3000 Percentage of codec 3 = 0.2 No. Codec ChannelCap Percentage Not a HASH reference at C:/Strawberry/perl/vendor/lib/Text/Diff.pm lin +e 46, <STDIN> line 10.

In reply to Re^3: Text::Diff::Table output, but want to show all lines by tctoa
in thread 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.