in reply to Need help in Text::Table

FWIW, I think that what works works, but what doesn't work doesn't work. Your script isn't working because you're working too hard at it. There's only five names on the list, so why not hardcode them? I'd suggest taking a break, then go back to the beginning. I took your script and reduced it to a bare minimum that works. You could start with this skeleton and gradually, incrementally build upon it. Keep on trying!
#!/usr/lib/perl use strict; use warnings; use Text::Table; my $tb = Text::Table->new( "NAME----------", "Age----------", "Department-----------"); $tb->load( ["Ram", 25, "HR"], ["Ravi", 28, "HR"], ["Raju", 27, "IT"], ["Ajay", 26, "IT"], ["Rani", 25, "IT"], ); my $o = ''; $o .= $tb->rule( q{_} ); $o .= $tb->body(); $o .= $tb->rule( q{_} ); open STDOUT, '>-' or die $!; print my @lines = $tb->table; close STDOUT; __END__ The employee name is : Ram Age: 25 years Department: HR The employee name is : Ravi Age: 28 years Department: HR The employee name is : Raju Age: 27 years Department: IT The employee name is : Ajay Age: 26 years Department: IT The employee name is : Rani Age: 25 years Department: IT

Replies are listed 'Best First'.
Re^2: Need help in Text::Table
by Anonymous Monk on Jun 14, 2012 at 13:33 UTC
    LOL