in reply to char substitution without regexes
Good rule of thumb: whenever you think "lookup table", your next thought should be "use a hash".
my (@list, %find); @list = qw/a t g c/; # You can do it manually... @find{@list} = qw/t a c g/; # ...or programmatically: @find{@list} = map {reverse @list[$_*2, $_*2+1] } 0..@list/2-1; print "$_: $find{$_}\n" for @list;
Output:
a: t t: a g: c c: g
|
|---|