On Sat, Jun 04, 2005 at 04:46:38PM -0700, Michael G Schwern wrote: > On Sat, Jun 04, 2005 at 10:52:20PM -0000, Sebastian wrote: > > Test case: perl -le 'sub a { print exists $_[0] } a(undef); a($f = undef);' > > Problem: Using exists() on @_ does not work as expected with undef > > This sheds some light on the problem. They definately contain different > structures. Don't know if Devel::Peek simply can't read the former @_ magic > in element 0 or if there's simply nothing there.
exists() on an array is just a hack that checks whether the element is &PL_sv_undef or some other SV (which may or may not have an undef value). foo(undef) manages to the set the element to &PL_sv_undef. Can't really be fixed short of using some other static SV to mark unused elements (cf PL_sv_placeholder), but personally I think that's throwing good money after bad. -- Technology is dominated by two types of people: those who understand what they do not manage, and those who manage what they do not understand.