>>18
あまり複雑な条件では使わない

my $fh = new IO::File ">hoge";
return undef unless defined $fh;
とか

$str .= "hoge¥n";
$str .= "moge¥n" if $flag;
return $str;
とか