in reply to Using doublequotes in a system call

You could try using qq{}, like this:

system(qq{$useradd -c "$fullname"});

That doesn't explain the specific error you see, but it's something to try. I don't have a Linux system to test useradd with.

UPDATE: On another read, I just noticed that this is apparently being run from the web, setuid root? You are a braver soul than I, if so. ;)

Anyway, in that circumstance, I'd recommend using a list of arguments to system(), to guard against dangerous input. And then I'd carefully check the input anyway (which you certainly could be doing already -- I know I'm only looking at one line of your script out of context).

- Matt Riffle