During the execution of the body, $handlerid is the id of the when command to which the body belongs. These commands are equivalent:
when X -temp { do_stuff; } when X { do_stuff; delete $handlerid; }