When i try to @arr=undef the tie'magic is called twice. Why?sub trigger{print "Triggered: ",map {defined $_ ? " $_" : 'UNDEF'}@_," +\n"}
Second question: why the code is not triggered when i do a reference to some tied array's elements?# rest of the code as before.. print "\tclearing with undef \@arr:\n" and undef @arr; print "\tSetting list:\n" and @arr = qw(a); print "\tclearing with \@arr=undef:\n" and @arr=undef; print "\tSetting list:\n" and @arr = qw(a); print "\tclearing with \@arr=():\n" and @arr=(); __OUT__ clearing with undef @arr: Triggered: Arraytrigger=ARRAY(0x6ab224) Setting list: Triggered: Arraytrigger=ARRAY(0x6ab224) Triggered: Arraytrigger=ARRAY(0x6ab224) 0 a clearing with @arr=undef: Triggered: Arraytrigger=ARRAY(0x6ab224) Triggered: Arraytrigger=ARRAY(0x6ab224) 0UNDEF Setting list: Triggered: Arraytrigger=ARRAY(0x6ab224) Triggered: Arraytrigger=ARRAY(0x6ab224) 0 a clearing with @arr=(): Triggered: Arraytrigger=ARRAY(0x6ab224)
Third and more important, why i'm no more able to print my array? nor dump or dd it? a simplymy $ref = \$arr[0]; print "\tsetting by reference:\n" and $ref=11; __OUT__ setting by reference:
put before clearing the array simply make my program hang, while eating lot of memory in with my Strawberry perl 5.14.2?print "\@arr [@arr]\n";
In reply to Re: Is tie inteded to be used in this way? Few question arise
by Discipulus
in thread Is tie inteded to be used in this way?
by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |