sub fexists (-f $_[0] ? $_[0] : undef); my $file = fexists ($p) // fexists ("$p.exe") // fexists ("$p.sh") // …;