use strict; use warnings; my @array = (0, 1, 2); untouched ($array[3]); print exists $array[3] ? "Element exists" : "No element"; touch ($array[3]); print "\n", exists $array[3] ? "Element exists" : "No element"; sub untouched { } sub touch { $_[0] = 1; }