#!/usr/bin/perl use strict; use warnings; no warnings 'uninitialized'; my @array = 1 .. 5; $\ = "\n"; sub check { print "array length: " . @array; use tt; [% FOR check IN ["exists", "defined", "true", "" ] %] for my $i ( 0 .. $#array ) { print "[% check %]([$i]) is " . [% check %]( $array[$i] ); } [% END %] no tt; print; } sub true { !!$_[0] } check; delete $array[$_] for 2 .. 3; # creates a hole check; undef $array[0]; # operates on the slot, not the array check; delete $array[-1]; # reduces length check; undef @array; # clears the array check; @array = 1 .. 3; check;