http://www.perlmonks.org?node_id=314372

Sprad has asked for the wisdom of the Perl Monks concerning the following question:

I'm probably doing something stupid here, but I can't seem to figure it out. I have this line in a script:
exec "foo.pl" or die "exec failed: $!\n";
It returns the error: exec failed: Invalid argument

I've tried using single quotes, double quotes, putting the "foo.pl" in a scalar and passing that instead, using parens or not, using other commands instead of foo.pl (such as 'dir')... Nothing seems to work.

Please make me kick myself.

Pre-submission update: I was double-checking some things before hitting 'create', and I found that running the line with warnings on will give a little more information: Can't exec "cmd.exe": Invalid argument at ... So maybe it's not my fault?

---
A fair fight is a sign of poor planning.