You're using system() incorrectly, specifically its return value. The error message is misleading, $! contains junk from a previous system call. Using system() correctly is very difficult, have a peek at the official documentation. All Perl built-ins suck, this one sucks the most.
in reply to Bad file descriptor after vmran command using system()
Instead use autodie for proper error handling, it's tested and you get nice default error messages:
use autodie qw(:all); # replaces system()
system $command; # implicit error handler