in reply to My first thought was to build a macro... was I right?

sub do_or_log_error { my $coderef = shift; my $syslogger = shift; my $param = shift; eval { $coderef->($param) }; if ($@) { $syslogger->LOG('error', "$param: $@"); } } sub my_rmtree { # yours was infinite loop! do_or_log_error(\&rmtree, @_); } sub my_unlink { # yours was infinite loop! do_or_log_error(sub { unlink @_ }, @_); }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.