Perl: After a successful system call, “or die” command still ends script

前端 未结 5 1423
庸人自扰
庸人自扰 2020-12-17 16:46

I am using the following line to make a simple system call which works:

system (\"mkdir -p Purged\") or die \"Failed to mkdir.\" ;

Executin

5条回答
  •  清酒与你
    2020-12-17 17:10

    system returns 0 on success, so you want and rather than or.

    See also: use autodie qw( system );

提交回复
热议问题