$ perl use Array::RefElem qw/av_store hv_store/; hv_store %h, 'ro', ${\'readonly_hashval'}; av_store @a, 5, ${\'readonly_aryelem'}; print "=$h{ro}=$a[5]=\n"; defined eval {$h{ro} = 'newval'} or print "Exception: $@"; defined eval {$a[5] = 'newval'} or print "Exception: $@"; ^D =readonly_hashval=readonly_aryelem= Exception: Modification of a read-only value attempted at - line 7. Exception: Modification of a read-only value attempted at - line 9.