sub log_action { my ($action_type, $string) = @_; if (lc($action_type) eq 'error') { print "\n$string\n\n"; print FH "$format $string\n"; ... }