@gi=("Galpha-i1", "Galpha-i2", "Galpha-i3"); @gt=("Galpha-t1", "Galpha-t2", "Galpha-t3"); %gp = ( 'G11' => 'Galpha-11', 'G12' => 'Galpha-12', 'G13' => 'Galpha-13', 'G14' => 'Galpha-14', 'G15' => 'Galpha-15', 'G16' => 'Galpha-16', 'Gs' => 'Galpha-s', 'Gz' => 'Galpha-z', 'Golf' => 'Galpha-olf', 'Go' => 'Galpha-o', 'Gq' => 'Galpha-q', 'Gi' => "@gi", 'Gt'=> "@gt",) ; #the program is about g-proteins.the keys of the hash are the words i #want to find and the values the words i'd like to replace them with while (<>) { #while loop to go through the file and the pattern matching to get the #correct tab if ($_=~/^.*\t.*\t(.*)\t.*\t.*/mgi) { $i=$1; $f=$_; chomp $f; $i=~s/ //g; $j=$gp{$i}; @values= split (' ',$j); foreach $val (@values) { $k=$f; $k=~s/$i/$val/mg; print "$k\n"; } } }