in reply to Is tie inteded to be used in this way?
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is tie inteded to be used in this way? Few question arise
by choroba (Cardinal) on Apr 28, 2015 at 22:18 UTC | |
by Discipulus (Canon) on May 01, 2015 at 16:58 UTC | |
by choroba (Cardinal) on May 01, 2015 at 19:02 UTC | |
by Discipulus (Canon) on Apr 29, 2015 at 09:57 UTC |