On Mon, Feb 17, 2003 at 02:14:59AM +0200, Enache Adrian wrote: > I expected from it to: > > 1. print '(1) (1) (1)' ... > 2. go in some crazy loop. Before proceeding, mg_get() saves, then turns off, any magic associated with the SV - I guess to avoid recursive crazy loops like you mention. This is why 'untie $a', and '$a' have no magical effect within FETCH(). The cause of the original coredump was that *a = \1 was immediately freeing the tied scalar, since things pushed onto the stack aren't refcounted. You can (almost) achieve similar effects with code like $a = 1; f($a); sub f { *a = \1; do_something_with($_[0]) } except that av_fetch() has explicit code it in such that when it tries to retrieve element n from @_, it checks that its a freed scalar, and if so, returns undef instead. This is pure hackery since sometimes the sv may have since been reassigned. -- But Pity stayed his hand. "It's a pity I've run out of bullets", he thought. - "Bored of the Rings"Thread Previous | Thread Next