Your problem seems to be from trying to get the Perl script (server side) to execute a client side command. The "diruse" command is being run on the webserver, and isn't giving the results from your client.
For client side you might want to try ... Javascript?!? (dooberwah ducks)
-Ben Jacobs