in reply to printing complex data structures

> Why does it complain if I write base_code (\%codes) in line 17 ? I thought it must be a reference..

Because you are using a prototype (\%) which is only accepting %vars and delivering refs.

Better don't use prototypes if you don't know how to handle them... or in other words if you are a beginner.

see perlsub#Prototypes for details

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