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.For example: (30 - field data) = additonal spacing Needed Output: Ent , Name , SCO11 , RUN , Current Data: Ent, Name, SCO11, RUN, Ent, Name, NA932, TAKE, I wrote the following code for equal spacing: $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/; } } } }
Edit kudra, 2002-05-25 Added code tags
In reply to Re: Re: Equal line spacing in records of a file
by vanuatu10
in thread Equal line spacing in records of a file
by vanuatu10
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |