#from 'exec' sub &log_action($error) if ($count > 0); # ... #later... sub log_action { my $error = shift; print "\n$error\n\n" && # next print FH is fishy. When is FH opened and closed? print FH "$format $error" if $error; }