in reply to Hash creation

Do add "use strict;" on top of your scripts. Always!

Your problem is that you are confusing hashes and hash references and are accessing two different variables ... which is something use strict would tell you.

The $newhash{key} accesses the key within the %newhash variable (notice the change of the sigil!), on the other hand the $newhash = { new_value => $input{red} }; sets the scalar variable $newhash to the reference to an anonymous hash containing one key ("new_value") and one value ($input{red}). The %newhash and $newhash are tow different, completely unrelated variables.

If you want to define a hash you have to use % and () instead of $ and {}: my %newhash = ( new_value => $input{red}) and then to access the value by $newhash{new_value}.

Or you can use the reference: my $newhash = { new_value => $input{red} }; and access the value by $newhash->{new_value}.