#!/usr/bin/perl -w use strict; my @gi=("Galpha-i1", "Galpha-i2", "Galpha-i3"); my @gt=("Galpha-t1", "Galpha-t2", "Galpha-t3"); my %gp = ( G11 => [qw( Galpha-11 )], G12 => [qw( Galpha-12 )], G13 => [qw( Galpha-13 )], G14 => [qw( Galpha-14 )], G15 => [qw( Galpha-15 )], G16 => [qw( Galpha-16 )], Gs => [qw( Galpha-s )], Gz => [qw( Galpha-z )], Golf => [qw( Galpha-olf )], Go => [qw( Galpha-o )], Gq => [qw( Galpha-q )], Gi => [@gi], Gt => [@gt], ); while () { chomp; my @columns = split(/\|/, $_); next if ( @columns <5 or !exists $gp{$columns[2]}); foreach my $replacement (@{$gp{$columns[2]}}) { print "$columns[0]|$columns[1]|$replacement|", join("|",@columns[3..@columns-1]),"\n"; } } =prints biologist|xargon|Galpha-i1|question|col5 biologist|xargon|Galpha-i2|question|col5 biologist|xargon|Galpha-i3|question|col5 bobby|jane|Galpha-11|somewthing|col5|col6 =cut __DATA__ biologist|xargon|Gi|question|col5 bobby|jane|G11|somewthing|col5|col6 perl|monks|G11|too_short #### Gq => [qw( Galpha-q )], Gi => [@gi],