1.外部コマンドの実行
$path = 'C:\'; $result = `dir \"$path\"`; $result = system('dir', "$path"); if($result != 0){ #ok }else{ #ng }
2.Yes/No
sub yesno{ my $comment = shift; my $default = shift; if($default){ $comment .= " ([y]/n): "; }else{ $comment .= " (y/[n]): "; $default = 0; } my $prv = $|; $| = 1; print $comment; $| = $prv; my $ans = ; chomp($ans); $ans = uc($ans); if($ans eq 'Y'){ return(1); }elsif($ans eq 'N'){ return(0); } return($default); }
No comments:
Post a Comment