From: Govinderjit Dhinsa <[EMAIL PROTECTED]>
<snip>
> My question was;
> How do I put a condition on the program, as I only want data from the
> input files, which at 'field 15' has a 'M' and some other fileds that I
> need(as marked on example data)!
<snip>
If you mean by "field 15" the fifteenth element in your array, try:
> while($line=<iscd>){
> chomp $line;
> @fields=split "\t",$line;
if ($fields[14] =~ /M/) {
> printf sortcode "\n%6.6
> s%8.8s%27.27s%20.20s%5.5s%16.16s%10.10s%8.8s%10.10s",
> $fields[0],$fields[5],
>
> $fields[70],$fields[71],$fields[73],$fields[74],$fields[75],
> $fields[76],$fields[77];
}
> }
>
> close iscd;
> close sortcode;
> exit;
You'll want to read up on regexp matching to make this condition more
restrictive and to find out how to match your other conditions.
Dave