Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > ouput issues

Reply
Thread Tools

ouput issues

 
 
slash
Guest
Posts: n/a
 
      07-22-2003
Hi,
I am new to programming an am running into a simple problem and can
definitely use some advice or suggestions.
Following is the output the program below generates:

quick brown fox
quick brown fox jumped
quick brown fox jumped over
brown fox jumped over lazy
fox jumped over lazy dog
jumped over lazy dog tripped
over lazy dog tripped over
lazy dog tripped over resting
dog tripped over resting fox


use Text::Table;
undef $/;
my @words = split /\W+/, <> ;
my $line_number = 2;
my $n;
my $n_cols = 5;
my $col = { align => 'left'}; # no title, left alignment
my $tb = Text::Table->new( ( $col) x $n_cols);
my @stack = ( '' ) x $n_cols;
foreach $word ( @words ) {
shift @stack;
push @stack, $word;
$tb->add( @stack);
}
my @lines = $tb->table( $line_number, $n);
print @lines;

=============================
I want to add two more lines to be processed such that the ouput looks
like the following:

quick brown fox
quick brown fox jumped
quick brown fox jumped over
brown fox jumped over lazy
fox jumped over lazy dog
jumped over lazy dog tripped
over lazy dog tripped over
lazy dog tripped over resting
dog tripped over resting fox
tripped over resting fox
over resting fox

Is this possible?

Thanks,
Slash
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
incompatible ouput files koyel.aphy@gmail.com VHDL 3 10-08-2008 07:53 PM
redirect ouput saif.shakeel@gmail.com Python 1 04-23-2007 12:49 PM
preserving color ouput of a shell command via os.popen() zeezlo@yahoo.com Python 3 09-27-2006 03:07 AM
Acct-Input/Ouput-Gigawords bledabua Cisco 0 10-25-2004 01:06 PM
Re: ouput redirection..a newbie question Jp Calderone Python 2 12-15-2003 08:27 PM



Advertisments