use strict; use warnings; use Devel::Peek; no warnings 'uninitialized'; my $c; is_defined('Beginning state: $c is ', $c); Dump($c); print "\n$c\n"; is_defined('State after printing: $c is ', $c); Dump($c); print "\n", (0 + $c), "\n"; is_defined('State after integer operation: $c is ', $c); Dump($c); $c = 0 + $c; is_defined("\nState after assignment: \$c is ", $c); Dump($c); $c = undef; is_defined("\nState after assigning undef: \$c is ", $c); Dump($c); sub is_defined { my ($msg, $value) = @_; print $msg, (defined $value ? '' : 'not '), "defined.\n"; } #### Beginning state: $c is not defined. SV = NULL(0x0) at 0x1f5cec0 REFCNT = 1 FLAGS = () State after printing: $c is not defined. SV = PV(0x1f3de10) at 0x1f5cec0 REFCNT = 1 FLAGS = () PV = 0 0 State after integer operation: $c is not defined. SV = PVNV(0x1f3c0d0) at 0x1f5cec0 REFCNT = 1 FLAGS = () IV = 0 NV = 0 PV = 0 State after assignment: $c is defined. SV = PVNV(0x1f3c0d0) at 0x1f5cec0 REFCNT = 1 FLAGS = (NOK,pNOK) IV = 0 NV = 0 PV = 0 State after assigning undef: $c is not defined. SV = PVNV(0x1a0f0d0) at 0x1a2fec0 REFCNT = 1 FLAGS = () IV = 0 NV = 0 PV = 0