in reply to safe navigation in perl?

Maybe something like (untested)
    $_ and $_->delete for $dom->find($whatever);
although I'm not convinced this syntax is preferable to the two-statement version you give initially in the OP, which seems more readable/maintainable.

Update: Of course, the for-loop expands easily into
    $_ and $_->delete for map $dom->find($_), $whatever, $whomever, @etc;
or
    $_->delete for grep $_, map $dom->find($_), $whatever, $whomever, @etc;
(also untested), although the nested aliasing of  $_ may make these a bit hard to follow.


Give a man a fish:  <%-{-{-{-<