my $file = "LIST"; open (FH, "< $file") or die "Can't open $file for read: $!"; my @hsa_sub = ; for($x=0;$x<=$#hsa_sub;$x++) { $s=$hsa_sub[$x]; $sline=`cat siper_sub | grep -n $s`; `sed '/substrate/!d; /$s/!d;{n;p}' everything_hsa | grep -i product | awk {'print $2,$3,$4'} >> prodlist` my $fil = "prodlist"; open (FH, "< $fil") or die "Can't open $fil for read: $!"; my @prod.$s.$x = ; }