tie issue:

use strict; # When array dereferencing a tied scalar it seems like # it gets stuck. { package FirstElem; sub TIESCALAR { my $class = shift; my ($list) = @_; return bless \$list => $class; } sub FETCH { ${$_[0]}->[0] } } my @plain = 'a' .. 'z'; my @arefs = map [ $_ ], @plain; tie my $plain, FirstElem::, \@plain; tie my $arefs, FirstElem::, \@arefs; shift @plain; print $plain; # b shift @plain; print $plain; # c shift @plain; print $plain; # d shift @plain; print $plain; # e print "\n"; shift @arefs; print @$arefs; # b shift @arefs; print @$arefs; # b, should be c shift @arefs; print @$arefs; # b, should be d, my $copy = $arefs; # This updates it, @$arefs is now d. shift @arefs; print @$arefs; # d, should be e __END__ Output: bcde bbbd
[download]