vanuatu10 has asked for the wisdom of the Perl Monks concerning the following question:
How can I make the file have equal field spacing? There has be be a was to count the contents of each line in the array and add, assuming staticval = 30, spaces before the commas of each field minus the charater in each field. In example, "Ent," would turn out to be staticval minus the number of characters found in Ent. This would be Ent followed by twenty-seven spaces and a comma. updated by boo_radley : formatting, code tags$counter = 0; foreach(@newstuff){ $counter++; if(m/Ent/){ $counter=0;} if(m/Payor/){ if($counter > $hold){ $hold = $counter; } } } $counter2 = 0; foreach(@newstuff){ $counter2++; if(m/Ent/){ $counter2=0;} if(m/Payor/){ if($counter2 < $hold){ $temp = $counter2; for($temp;$temp < $hold; $temp++){ #for($j=0;$j < $hold; $j++){ s/Payor/\nPayor/; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Field Spacing
by talexb (Chancellor) on May 24, 2002 at 17:56 UTC | |
|
Re: Field Spacing
by mr_mischief (Monsignor) on May 24, 2002 at 19:51 UTC | |
|
Re: Field Spacing
by vladb (Vicar) on May 24, 2002 at 17:56 UTC | |
|
Re: Field Spacing
by krujos (Curate) on May 24, 2002 at 18:23 UTC | |
|
Re: Field Spacing
by greywolf (Priest) on May 24, 2002 at 18:15 UTC |