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"; }