in reply to system function behaviour

system("foo.pl","&");

This calls foo.pl with the character & as its first argument.

system("foo.pl & ");

This calls /bin/sh (or your appropriate system shell) and passes it the whole string as command. The shell then interprets the & as a directive to background the command.

The next two are equivalent, but only in the second the shell is involved:

system("foo.pl", "&"); system("foo.pl '&' ");