sub fexist { for (glob $_[0]) { return 3 if -l; return 2 if -d; return 1 if -f; } return 0; }