in reply to getting multiple return values from system()

system("/usr/bin/ssh $server \"/usr/sbin/useradd $login\"");

Do you really use the single-argument form of system? This usually involves a shell, and forces you to guess what shell is invoked and what type of quoting it needs. Typically, you will get lots of problems as soon as you include white space, special characters, or variables. You have all of these.

Use the list form of system:

system('/usr/bin/ssh',$server,"/usr/sbin/useradd $login");

And I'm very sure that this call will fail with a "command not found" error. You don't want to invoke the program "/usr/sbin/useradd joe average user" when $login is "joe average user". You want to invoke the program "/usr/sbin/useradd" and pass whatever $login contains as first argument. ssh does not invoke the shell on the remote system.

So:

system('/usr/bin/ssh',$server,'/usr/sbin/useradd',$login);

What's the big difference? No quoting mess, all arguments end exactly where you want them, even if they contain usual characters.

Why?

Unix systems pass an array of arguments to each program (that's where C's argv argument to main() comes from, and perl copies that information into $^X, $0, and @ARGV). Only the shell splits the entered string into an array of arguments, typically on $ENV{'IFS'}. It also expands variables, * and ?, and several other constructs. The first element of the array is also taken as the name of the program to be started.

DOS and Windows, on the other hand, pass a single string to the program invoked. command.com trims the input and splits it at the first white space into executable name and argument string, expanding variables, but not * and ?. That is left to the invoked executable, and the executable also has to split the argument string into an array. The latter typically happens in the C runtime library and it depends on the implementation, * and ? are typically passed unmodified to the program code.

Perl tries to hide the evil differences between differrent operating systems from you, so even on Windows, the multiple-argument form of system() works on Windows, automatically quoting arguments where needed (or at least, it should do so). There are several special tricks for system() on different platforms, see http://search.cpan.org/~rgarcia/perl-5.10.0/pod/perlport.pod#system.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)