sub log_action { my $i = shift; if ($i eq "error") { print "\n$error\n\n"; print FH "$format $error"; ... }