Perl :: デバッグ用のファイル出力

sub print_log {
    my $str = shift;
    my $logfile = "/path/to/debug.log";
    my $msg = sprintf("%s\x0A", $str);
    open FH, ">> $logfile" or die "Can't open $logfile:$!";
    print FH $msg;
    close FH;
}
my $str = "Now debugging!";
print_log($str);