> Hello everyone, I finally got my perl program running (below). What I had > to do was get certain 'data types' (fields) from a input file and out put > to a new file. > 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)! > > e.g Data example from input file which has 20+. Has fields('data types') > > 086117...00.BNY INTERNATIONAL LTD .CO-OPERATIVE BANK .THE CO-OP > ERATIVE BANK PLC ..0021..A..15/10/1999 > ..*****M*****.18/05/199 > 9...301599.0021.01.00.0021.02.Y.N.............N..14/11/1999...29-MAY-2 > 001 .N.......25/05/2001 05:18 .5250 .M.03/10 > /1996..21 ...GB .M....GMAC -Comercial CR Ltd > .1..Brighton, E.Sussex ...Sovereign Hse > .Church St ...Brighton > .E.Sussex .BN1 .1SS .01273 .321211 > .. > > My program: > > open iscd,"iscd.tmp" or die "Cannot open $ARGV[0]",$!; > open sortcode,">sortcode.tmp"; > while($line=<iscd>){ > chomp $line; > @fields=split "\t",$line; > 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; > > > > > > > > > > > > > Govinderjit Dhinsa >