in reply to Keep getting "use of unitialized value" error in a weird place

Please try Data::Dumper to check if %codon and @array4 really hold what you think they do.

@array4=0 is only initializing the first element $array4[0] !

Most probbaly you are pushing non existing elements from %codon which fill @array4 with undef values.

see also basic debugging checklist

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

PS: As a side note: badly formated code like yours is the best publicity for Python... :-/