in reply to Re: Re: Q on HTML::Element recursive lambda comment
in thread Q on HTML::Element recursive lambda comment

Well, I'd do it by leaving in the undef statement. Either that, or replace it with something commented:
{ ... $give_id->($start_node); $give_id = 0; # Break circular structure and avoid memory leak }
That is, just make sure to set $give_id to some value that doesn't depend on $give_id before $give_id goes out of scope.