this works hard coded obviously: foreach $e (@{$data->{channel}{item} }) but not for foreach $e (@{$data->(eval($y) }) where I want eval($y) = {channel}{item} (which is in the code below) or {item} with the appropriate data structure . Got errors about not blessing the eval variable