At 11:35 20.06.2001 +0100, Govinderjit Dhinsa wrote:
>Iv been givin this program to modify, but I can not astblish what some parts
>of the program are doing.   From
>
>printf........
>to
>}
>
>Can any body help please and run through it with me pls!!!!!
>
>
>
>open iscd,"<$ARGV[0]" or die "Cannot open $ARGV[0]",$!;

this opens a file that's been typed in at the command line

>open sortcode,">$ARGV[1]";

this opens the second file that's been typed in at the command line

>while($line=<iscd>){
>         chomp $line;
>         @fields=split "\t",$line;

this grabs one line at a time from the first file and splits it out into an 
array -- the line is apparently a tab delimited list

>         printf sortcode
>"\n%6.6s%8.8s%3.3s%27.27s%20.20s%35.35s%35.35s%10.10s%1.1s%1.1s%2.2s%2.2s%2.
>2s%2.2s%2.2s%2.2s%2.2s%2.2s%2.2s%2.2s%1.1s%1.1s%6.6s%35.35s%4.4s%4.4s%10.10s
>%8.8s",
>
>$fields[0],$fields[1],$fields[2],$fields[4],$fields[5],$fields[6],$fields[7]
>,$fields[11],$fields[14],$fields[25],
>
>$fields[26],$fields[27],$fields[28],$fields[29],$fields[30],$fields[31],$fie
>lds[32],$fields[33],
>
>$fields[34],$fields[35],$fields[58],$fields[60],$fields[61],$fields[64],
>                $fields[76],$fields[77],$fields[78],$fields[79];
>}

this formats the data from the line and prints it out to the second 
file.  There's probably a cleaner and easier-to-read way to do 
this.  However, if you look at the docs for printf, and compare the input 
and output files you should be able to figure out exactly how the lines are 
getting formatted and printed.

Aaron Craig
Programming
iSoftitler.com

Reply via email to