harishnuti has asked for the wisdom of the Perl Monks concerning the following question:
__DATA__ TABNAME 06100 01010 06000 00110A # The above is header which is present in @header !W31801!-->!919!-->!90200809!-->!840!-->!MO! !W31801!-->!919!-->!902008!-->!74!-->!MO! #The above are the data present in @data array # iam doing below ... my $disp = sprintf("-%10s\n",join("\t",@header)); print $disp; # i printed header foreach my $line (@data){ my @arr = split(/-->/,$line); my $disp = sprintf("-%10s\n",join("\t",@arr)); print $disp; } # From above iam cant achieve what i need, the resultant data is out o +f format... # All i need is , no matter whats the size of data or header, i want t +o print each column with width of 10 characters . __DATA__ -TABNAME 06100 01010 06000 00110A -!W31801! !919! !90200809! !840! !MO! -!W31801! !919! !902008! !74! !MO! # As you can see output , headers are not alighned properly, i need he +aders and corresponding data to be left alighned and in same column..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print Array items in Fixed width
by BrowserUk (Patriarch) on Jul 31, 2008 at 05:46 UTC | |
|
Re: Print Array items in Fixed width
by ikegami (Patriarch) on Jul 31, 2008 at 04:31 UTC | |
by harishnuti (Beadle) on Jul 31, 2008 at 05:09 UTC | |
|
Re: Print Array items in Fixed width
by broomduster (Priest) on Jul 31, 2008 at 08:53 UTC | |
by harishnuti (Beadle) on Aug 01, 2008 at 02:59 UTC | |
by BrowserUk (Patriarch) on Aug 01, 2008 at 03:38 UTC | |
by broomduster (Priest) on Aug 01, 2008 at 08:37 UTC | |
by harishnuti (Beadle) on Aug 01, 2008 at 10:09 UTC |