http://www.perlmonks.org?node_id=1177212


in reply to Another "Can't use string as an ARRAY ref"

Hi bradcathey,

One of the first things you do in your loop is assign $plants->[$i]{'common'} =  $plants->[$i]{'common_name'};, but then later on you attempt to use $plants->[$i]{'common'}, which now holds a string, as an array ref when you write $plants->[$i]{'common'}->[$jctr]{'sizes'} = ..., that's where the error is coming from. Are you perhaps using the hash key common twice by accident?

Hope this helps,
-- Hauke D