I am using the following line to make a simple system call which works:
system (\"mkdir -p Purged\") or die \"Failed to mkdir.\" ;
Executin
A one-line solution:
system("if printf '' > tmp.txt; then exit 1; else exit 0; fi ;") or die("unable to clobber tmp.txt");