Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

lodin's scratchpad

by lodin (Hermit)
on Aug 19, 2007 at 11:24 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-18 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found