Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - ouput issues

 
Thread Tools Search this Thread
Old 07-22-2003, 06:00 PM   #1
Default ouput issues


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


slash
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump