find ./cache -mtime +60 -delete find ./cache -name "*.html" -depth 1 -mtime +30 -delete find ./cache -type f -depth 1 -mtime +30 -delete
といった方法で確認しているのですが、なんかバッドノウハウ的。if (defined %{$a->{"a"}}) { ...
use strict; use warnings; my $a; # exists if (exists $a->{"a"}) { print qq(\$a->{"a"} exists\n); } else { print qq(\$a->{"a"} does not exist\n); } if (exists $a->{"a"}->{"b"}) { print qq(\$a->{"a"}->{"b"} exists\n); } else { print qq(\$a->{"a"}->{"b"} does not exist\n); } if (exists $a->{"a"}) { print qq(\$a->{"a"} exists\n); } else { print qq(\$a->{"a"} does not exist\n); } # defined if (defined $a->{"c"}) { print qq(\$a->{"c"} is defined\n); } else { print qq(\$a->{"c"} is not defined\n); } if (defined $a->{"c"}->{"b"}) { print qq(\$a->{"c"}->{"b"} defined\n); } else { print qq(\$a->{"c"}->{"b"} does not defined\n); } if (defined $a->{"c"}) { print qq(\$a->{"c"} is defined\n); } else { print qq(\$a->{"c"} is not defined\n); } # 途中ノードの存在確認 if (defined %{$a->{"a"}}) { print qq(%{\$a->{"a"}} is defined\n); } else { print qq(%{\$a->{"a"}} is not defined\n); } if (defined %{$a->{"c"}}) { print qq(%{\$a->{"c"}} is defined\n); } else { print qq(%{\$a->{"c"}} is not defined\n); }
■初めてのPerl |
■続・初めてのPerl 改訂版 |