Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

lodin's scratchpad

by lodin (Hermit)
on Aug 19, 2007 at 11:24 UTC ( #633591=scratchpad: print w/replies, xml ) Need Help??


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
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2021-12-04 00:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?