# this breaks if @pathparts has a double quote in it! my $element = '$hash' . join '', map { qq|{"$_"}| } @pathparts; eval "$element = undef";