You are trying to run
who with a single argument
>>/var/www/cgi-bin/new.txt while STDOUT redirection is done by shell and who does'nt use this argument as you might think (see
who). Run
system("who >>/var/www/cgi-bin/new.txt"); instead (so shell will catch the
>>) or use
IPC::Run (it can do redirection by itself).
Sorry if my advice was wrong.