c:\@Work\Perl\monks>perl -wMstrict -le "use feature 'state'; ;; my $hashref = { x => 'cat' }; S($hashref); ;; print 'A1: ', S('trash')->{x}; print 'A2: ', $hashref->{x}; ;; $hashref->{x} = 'mouse'; print 'B1: ', S('junk')->{x}; print 'B2: ', $hashref->{x}; ;; undef $hashref; print 'C1: ', S('dreck')->{x}; print 'C2: ', $hashref->{x}; ;; $hashref = { x => 'snark' }; print 'D1: ', S('bilge')->{x}; print 'D2: ', $hashref->{x}; ;; S('cruft')->{x} = 'oliphaunt'; print 'E1: ', S('fudge')->{x}; print 'E2: ', $hashref->{x}; ;; sub S { state $ref = shift; return $ref; } " A1: cat A2: cat B1: mouse B2: mouse C1: mouse Use of uninitialized value in print at -e line 1. C2: D1: mouse D2: snark E1: oliphaunt E2: snark